in Uncategorized

coppermine-gallery:Adding classname in Sysmenu and Submenu

I was trying to make new theme but got some lack of class name in Sysmenu and Submenu. Actually I wanted this type of class name in menu link
[sourcecode language=’css’]Home[/sourcecode]

Look if there was classname like “button_home” in each menu link then it’s easy to apply custom image or style using css.
Then I tried to make this happen and I did it. Here is what I have done

Open file galleryroot\include\ find function assemble_template_buttons and then find

[sourcecode language=’css’] foreach ($buttons as $button) {
if (isset($button[4])) {
} else {
After that just add
[sourcecode language=’css’]
if (isset($button[5])) {
} else {
Now find ‘{SPACER}’ => $spacer, and add the bellow line before this
‘{CLASSNAME}’ =>$classname,

Find function addbutton and change the function like bellow
[sourcecode language=’css’]
// Creates an array of tokens to be used with function assemble_template_buttons
// this function is used in this file it needs to be declared before being called.
if (!function_exists(‘addbutton’)) { //{THEMES}
function addbutton(&$menu,$href_lnk,$href_title,$href_tgt,$block_id,$spacer[b],$classname[/b]) {
} //{THEMES}

In the above code I have added the bold part to add a class name in menu link Cheesy

Now find this line “// HTML template for template sys_menu buttons”

and change code like bellow

[sourcecode language=’css’]
// HTML template for template sys_menu buttons
if (!isset($template_sys_menu_button)) { //{THEMES}
$template_sys_menu_button = <<

} //{THEMES}

Here I have changed the bold part Cheesy]

Now find with keyword addbutton and check all the matchings.
You will get this type of lines

// HTML template for template sys_menu buttons
if (!isset($sys_menu_buttons)) { //{THEMES}
addbutton($sys_menu_buttons,'{HOME_LNK}’, ‘{HOME_TITLE}’, ‘{HOME_TGT}’, ‘home’, $template_sys_menu_spacer, ‘button_home’);
addbutton($sys_menu_buttons,'{MY_GAL_LNK}’, ‘{MY_GAL_TITLE}’, ‘{MY_GAL_TGT}’, ‘my_gallery’, $template_sys_menu_spacer,’button_mygallery’);
addbutton($sys_menu_buttons, ‘{LOGIN_LNK}’, ‘{LOGIN_TITLE}’, ‘{LOGIN_TGT}’, ‘login’,”,’button_login’);
addbutton($sys_menu_buttons, ‘{LOGOUT_LNK}’, ‘{LOGOUT_TITLE}’, ‘{LOGOUT_TGT}’, ‘logout’, ”,’button_logout’);
// Login and Logout don’t have a spacer as only one is shown, and either would be the last option.
} //{THEMES}

Here I have added the bold part for class name. Hope this will help you.

Don’t hesitate to ask me if u are confued.

How can u add an image before a menu link
just add this type code in your style sheet. If class name of “Home” menu is “button_home” then
add new entry in css file like this
a.button_home{ background:url(images/icon_home.gif) left top no-repeat; padding-left:17px; padding-right:4px;}

Here icon_home.gif is image name that u have to put in “images” folder in the theme .
My post in coppermine forum: line is here