Add images to the menu

in Tutorials on 11 Dec 2010

Add images to the menu

Open Sources/Subs.php and almost at the very end, you'll see your forums menu.

For instance, lets use the profile button.... it looks like this:
'profile' => array(
'title' => $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),


Lets add the image URL to the 'title' like this...
'title' => '<img align="absMiddle" src="PATH TO IMAGE GOES HERE"/>&nbsp; ' .  $txt['profile'],


Now it looks like this:
'profile' => array(
'title' => '<img align="absMiddle" src="PATH TO IMAGE GOES HERE"/>&nbsp; ' .  $txt['profile'],
'href' => $scripturl . '?action=profile',
'show' => $context['allow_edit_profile'],
'sub_buttons' => array(
'summary' => array(
'title' => $txt['summary'],
'href' => $scripturl . '?action=profile',
'show' => true,
),


Use 12x12 images for best results.



idesignSMF Team
Mick is an American theme designer for Simple Machines Forum software currently living in South Florida, USA. He runs idesignSMF.com and started tinkering with SMF in 2006 where he created several SMF forums of his own before he founded idesignSMF in 2009 to which he is dedicated full time.

idesignSMF.com | SimpleMachines.org



4 Comments

Hello friend, I would like to know how to edit the code in the image on the button "FORUM" because it is added only after I install and simple portal in your post does not tell you how to insert the code for this button type.

I tried several times by changing the code that is added by simple portal, but not getting success, I'm leaving the button code "FORUM" you try to help me.

'forum' => array(
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],
'href' => $scripturl . ($modSettings['sp_portal_mode'] == 1 && empty($context['disable_sp']) ? '?action=forum' : ''),
'show' => in_array($modSettings['sp_portal_mode'], array(1, 3)) && empty($context['disable_sp']),
'sub_buttons' => array(
),


See how much different is the button code "HOME"

'home' => array(
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/house.png" alt="'.$txt['home']. '"/>&nbsp; ' . $txt['home'],
'href' => $modSettings['sp_portal_mode'] == 3 && empty($context['disable_sp']) ? $modSettings['sp_standalone_url'] : $scripturl,
'show' => true,
'sub_buttons' => array(
),
'is_last' => $context['right_to_left'],
// 'target' => '_blank',
#1
For simpleportal....

In Sources/Subs.php
Find:
'title' => empty($txt['sp-forum']) ? 'Forum' : $txt['sp-forum'],

Replace with:
'title' => '<img align="absMiddle" src="'. $settings['images_url']. '/menu_icons/yourimage.png" alt="'.$txt['sp-forum']. '"/>&nbsp; ' .  $txt['sp-forum'],



Make sure you add the image to the Menu_icons folder and replace the .png in the this code.
#2
Hello friend thanks for the help he gave everything right a merry Christmas and a prosperous new year.
#3
Hi All,

~Wish you all a Very Happy New Year~

Adding images to the forum menu,., Sounds cool!!



#4

rocket_launch

Brand spankin' new free SMF themes every month.