News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

buttonS

Started by !RFAN, April 25, 2010, 04:51:39 AM

Previous topic - Next topic

!RFAN

is there any possibility to change th buttons of "reply" , " quote",  "modify" etc... and to remove the text in smf 2 rc3??

i have done this in smf 1.1.11 but in smf 2 rc3 i was not able to do that..


Antechinus

Sure. Look for the quickbuttons classes in index.css and in Display.template.php. :)

!RFAN

i think i can only remove text from those two files.. okay..but first i want to change/replace the buttons..

i am using a custom theme.. i replaced the images in "buttons" folder with the buttons that i wanna have...  no chabge is appearing.. first iwill change the buttons.. then i will go any further..

i did this in smf 1.1.11 and it was working fine..

Antechinus

If you want to use image buttons there is a setting for that on the "Current Theme" page in admin.

!RFAN

i cant find any... can u specify..??
everyone says there is setting for that on current theme page but i cant find.. something missing there??

Antechinus

#5
Sorry, looks like that was removed from 2.0. It's been a while since I worked on 2.0 coding so I had forgotten that.

Ok, you can easily change the icons for a complete button that is the full size of each button. That can be done by using the quickbuttons classes in index.css. What you need to do is change the image called there for your new background image, and change the padding to centre the text on the new background. I would advise spriting the new buttons in the same way as the standard ones are done (this means stacking them up in one image) as this will give faster caching.   

Note that without hacking template code you cannot remove the text from these buttons. They will still display whatever font is called by the css, so your image buttons should be designed to be the right size but without text.

If you want to have the text as part of the image the you will have to remove it from the templates. This will mean editing the quickbuttons classes in Display.template.php, Profile.template.php, Recent.template.php and Search.template.php. I may have missed one as that list is from memory. The code you would be looking for is like this:

// Maybe we can approve it, maybe we should?
if ($message['can_approve'])
echo '
<li class="approve_button"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">', $txt['approve'], '</a></li>';


and you would be removing ', $txt['approve'], ' and substituting &nbsp; so the finished result would be:

// Maybe we can approve it, maybe we should?
if ($message['can_approve'])
echo '
<li class="approve_button"><a href="', $scripturl, '?action=moderate;area=postmod;sa=approve;topic=', $context['current_topic'], '.', $context['start'], ';msg=', $message['id'], ';', $context['session_var'], '=', $context['session_id'], '">&nbsp;</a></li>';


This will have to be repeated for each button in each template, and the sizes of each button will need to be set in the css.

Advertisement: