The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.



Post new topic Reply to topic  [ 16 posts ] 
Author Message
PostPosted: Fri Aug 28, 2009 9:54 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jul 26, 2008 12:48 pm
Posts: 4
I'm in the process of designing a template for a client, and for the frontpage items (and articles) overrides, I like to replace the icons for PDF, Print and Email for only text, which I can stylize. So far, I have no idea how to do it, and the API documentation of Joomla is really doing nothing to help. Is there anyone out there who knos how to accomplish this??

Edited This is an example http://www.n-medios.com.ar/demo/demo.html of what I'm trying to accomplish.


Top
 Profile  
 
PostPosted: Fri Aug 28, 2009 10:46 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Wed Aug 13, 2008 2:57 am
Posts: 20421
Location: Chennai, India
Joomla! already has an option to decide whether to show the links of PDF, Print and Email as icons or text. Review the Global Parameters in the Article Manager.

In addition, you can assign individual class to these items if need be. Look at the file default.php located in the directory \components\com_content\views\article\tmpl. You can override this file by copying this file to the directory \templates\your-template-name\html\com_content\article and modifying it. You should make this file a part of your template.

In addition to article you should also review the files for category, frontpage and section layouts.

_________________
- Ilagnayeru (MIG) Manickam
http://www.eegan.org - helping the poor and underprivileged
educate. empower. enrich.
Support the poor and underprivileged


Top
 Profile  
 
PostPosted: Fri Aug 28, 2009 11:15 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jul 26, 2008 12:48 pm
Posts: 4
Thanks for the quick response! I will follow your advice.

[Edited]

In the global parameters of the Article Manager there is no option about icons or text link for PDF, Print and Email. I'm using Joomla 1.5.14, so, I'm up to date with the system, but even so, I can't do what I want to do. If out there is any other suggestion or comment, I appreciate.


Top
 Profile  
 
PostPosted: Mon Aug 31, 2009 2:18 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jul 26, 2008 12:48 pm
Posts: 4
The function responsible for the icons is JHTML:

Code:
JHTML::_('icon.pdf', $this->item, $this->item->params, $this->access)


But I don't have the knowledge nor I found a good tutorial or example about this. and the documentation from the developers wiki is really poor. I really don't know why, but I know the Joomla community will come to my rescue.


Top
 Profile  
 
PostPosted: Mon Aug 31, 2009 3:20 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Sat Mar 25, 2006 4:40 pm
Posts: 24
In the parameters you switch icons to off and they are replaced with text.

Hope this helps

Regards

David

_________________
David Goode
3cellhosting.com - design for the discerning.

"Now where did I put that screwdriver?"


Top
 Profile  
 
PostPosted: Mon Aug 31, 2009 3:45 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Wed Aug 13, 2008 2:57 am
Posts: 20421
Location: Chennai, India
(a) In the Article Manager parameters or in other places such a Article Layout, you can specify whether you want to show the PDF, Print and E-mail as Icons or text. The parameters that control this are

Icons Hide Show
PDF Icon Hide Show
Print Icon Hide Show
E-mail Icon Hide Show

The decision to use Icons or Text is based on whether the parameter Icons is Show or Hide. After this, if PDF icon/text is shown or not is based on the Show or Hide selection for PDF Icon. This is applicable for Print as well as E-mail. I know it is confusing purely based on the text icon(s). I encourage to try different settings and review the HTML code generated.

(b) As I mentioned earlier, in the file default.php the section that is of interest to you is
Code:
   <?php if (!$this->print) : ?>
      <?php if ($this->params->get('show_pdf_icon')) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.pdf',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>

      <?php if ( $this->params->get( 'show_print_icon' )) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.print_popup',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>

      <?php if ($this->params->get('show_email_icon')) : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.email',  $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>
      <?php if ($canEdit) : ?>
      <td align="right" width="100%" class="buttonheading">
         <?php echo JHTML::_('icon.edit', $this->article, $this->params, $this->access); ?>
      </td>
      <?php endif; ?>
   <?php else : ?>
      <td align="right" width="100%" class="buttonheading">
      <?php echo JHTML::_('icon.print_screen',  $this->article, $this->params, $this->access); ?>
      </td>
   <?php endif; ?>

Probably what is more interesting to you would be the class of each of these items. In case if you are really interested in knowing the code for icons, review the file icon.php located in the directory \components\com_content\helpers. As indicated in the previous point (a), whether to display text or icon is controlled by the parameters mentioned. You should really concentrate on writing appropriate css for the class(es).

(c) Other files that you may have to change or override are
\components\com_content\views\category\tmpl\blog_item.php
\components\com_content\views\frontpage\tmpl\blog_item.php
\components\com_content\views\section\default_item.php

_________________
- Ilagnayeru (MIG) Manickam
http://www.eegan.org - helping the poor and underprivileged
educate. empower. enrich.
Support the poor and underprivileged


Top
 Profile  
 
PostPosted: Mon Aug 31, 2009 9:35 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Jul 26, 2008 12:48 pm
Posts: 4
Thanks for the fast answer. I did a fresh installation of Joomla and now it's working the way you pointed out. I have checked the icon.php file, to do some modifications on my own. Thanks again for all the help.


Top
 Profile  
 
PostPosted: Thu Sep 10, 2009 12:47 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Nov 14, 2006 3:29 am
Posts: 201
Hrm, image file names in un-templated code?
Can we override an /helper/icon.php file without core edits? (core edits are failures).


Top
 Profile  
 
PostPosted: Thu Sep 10, 2009 1:20 am 
User avatar
Joomla! Master
Joomla! Master

Joined: Wed Aug 13, 2008 2:57 am
Posts: 20421
Location: Chennai, India
(a) You cannot apply template override to the icon.php file located in the directory \components\com_content\helpers. It would involve modifying the core Joomla! file.

(b) If you have your own images for the PDF, eMail and Print button images you could use them by not modifying the icon.php file. Make sure that the images file names are the same as that of the following and copy them in the \images directory in your template.
pdf_button.png
emailButton.png
printButton.png

Note: Notice the inconsistencies in the file naming convention in terms of case usage and underscore usage.

_________________
- Ilagnayeru (MIG) Manickam
http://www.eegan.org - helping the poor and underprivileged
educate. empower. enrich.
Support the poor and underprivileged


Top
 Profile  
 
PostPosted: Thu Sep 10, 2009 2:00 am 
Joomla! Enthusiast
Joomla! Enthusiast

Joined: Tue Nov 14, 2006 3:29 am
Posts: 201
yeah I had to write my words into my image too since I can't have words AND image. Not that I'd want to use Joomla words anyway and without a good language override I guess writing words into images is the best way (which it isn't).


Top
 Profile  
 
PostPosted: Thu Dec 09, 2010 8:17 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Dec 09, 2010 7:18 am
Posts: 24
Hello and sorry for bumping the thread, but it seems pretty advising for similar tasks :)

I want to change the text of my E-mail button. I have set my site to hide pdf and email icons (so to display text), but I cannot find where is this text located so that I can change it.
I have tried modifying icon.php without any change at the frontend, so this must not be the right way.

The area I changed in icon.php:
Code:
      if ($params->get('show_icons'))    {
         $text = JHTML::_('image.site', 'emailButton.png', '/images/M_images/', NULL, NULL, JText::_('Email'));
      } else {
         $text = '&nbsp;'.JText::_('Email');
      }

      $attribs['title']   = JText::_( 'Email' );
      $attribs['onclick'] = "window.open(this.href,'win2','".$status."'); return false;";


Top
 Profile  
 
PostPosted: Thu Dec 09, 2010 12:32 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Wed Aug 13, 2008 2:57 am
Posts: 20421
Location: Chennai, India
You have to change the file en-GB.com_content.ini that is located in the directory \language\en-GB. For Example, to change the text E-Mail, you have to modify the following line of text.
Code:
EMAIL=E-mail

Make sure to take a copy of the file before modifying it.

_________________
- Ilagnayeru (MIG) Manickam
http://www.eegan.org - helping the poor and underprivileged
educate. empower. enrich.
Support the poor and underprivileged


Top
 Profile  
 
PostPosted: Mon Dec 13, 2010 8:23 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Dec 09, 2010 7:18 am
Posts: 24
It seemed to have worked from the code change. It might had to to with the cache. Thank you for your responses


Top
 Profile  
 
PostPosted: Fri Feb 18, 2011 1:13 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Fri Feb 18, 2011 1:08 pm
Posts: 1
hi, i have joomla 1.6 and installed different templates for some sites of one domain. i have the new icons for print, mail, pdf in the images folder of the template folder with exactly the same names, but in the frontend the standard icons are shown instead. do someone know where the problem could be? thanks a lot!


Top
 Profile  
 
PostPosted: Fri Apr 29, 2011 7:47 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Aug 30, 2007 3:03 pm
Posts: 7
You actually can override icons.php by simply including the class found in icons.php at the top of your template override.

Code:
class JHTMLIcon {

.... edit the methods found in here and they will overrride earlier values

}


Then as long as you keep the class name and and method names you can return whatever values you want.

I really just wanted to remove all the extra formatting in there such as the '&nbsp;' and the '|' or whatever your separator is in your language file.

This is really a bad file that needs a rewrite for sure. It forces a horizontal layout for the text format.

_________________
For a better world!


Top
 Profile  
 
PostPosted: Thu Mar 01, 2012 8:18 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Tue Aug 02, 2011 6:16 pm
Posts: 17
Hi, finally I have found something useful. Unfortunately I am not expert, not to say worse, of PHP and CSS... I am just lucky enough when I modify them ;)

This time I am having a very hard time with these customizations. Thanks to imanickam I have found where I should intervent, but when I watch the code I don't have a clue of what to do :)
I hope you can help me.

I would like to add to the template (which already has customizations of the article template) the Facebook, Twitter and possibly other buttons as I really love the original looking of the template and a plugin would not modify so beautifully :)
I am on J 1.7 and my problems are that in the default.php file I see code that calls those buttons and icons, but whenever I look for those names in my site I cannot find them (I though they were in the CSS and/or in other PHP files.

Here is the list of the parts of the custom default.php file (template):

Line 21:
Code:
$showIcons = ($params->get('show_print_icon') || $params->get('show_email_icon') || $canEdit);


From line 45 to 71:
Code:
<div class="rt-article-icons">
            <ul class="actions">
            <?php if (!$this->print) : ?>
            <?php if ($params->get('show_print_icon')) : ?>
            <li class="print-icon">
               <?php echo JHtml::_('icon.print_popup',  $this->item, $params); ?>
            </li>
            <?php endif; ?>
      
            <?php if ($params->get('show_email_icon')) : ?>
            <li class="email-icon">
               <?php echo JHtml::_('icon.email',  $this->item, $params); ?>
            </li>
            <?php endif; ?>
               
            <?php if ($canEdit) : ?>
            <li class="edit-icon">
               <?php echo JHtml::_('icon.edit', $this->item, $params); ?>
            </li>
            <?php endif; ?>
            <?php else : ?>
            <li>
               <?php echo JHtml::_('icon.print_screen',  $this->item, $params); ?>
            </li>
            <?php endif; ?>
            </ul>
         </div>


I would really appreciate if somebody could tell me what to add and where in order to have those two (by now) new buttons with icons.

Thanks in advance :)

P.S. I am afraid I should modify the core of Joomla in order to add those buttons, if it is not so much complex I would like to give a try, but I need some hints :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ] 



Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group