Paul Wake Posted February 21, 2007 Report Share Posted February 21, 2007 How would I properly add a menu item to a list of menu items similar to this one right here from genlib.php$menu .= "<li><a href=\"$browserepos_url\"><img src=\"$cms[tngpath]tng_repo.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[repositories]</a></li>\n";only the new menu item would be a link to the access log, along with PHP code keeping the link from showing up unless someone is logged in as an administrator?I use something like this<?php if( $allow_admin ) echo " <a href=\"showlog.php\" class=\"lightlinkmod\">$text[mnushowlog]</a> \n"; ?>on my home page, but that's a regular link, not something inside an HTML list like one finds on the other pages of template 5. When I tried plopping the line above in between this list tags of the first type of code, it broke genlib (plus, I couldn't find an icon to link to that goes with access log--has anyone ever seen one?). Any thoughts on what I did wrong (which I'm guessing had something to do with PHP inside of PHP)? Quote Link to comment Share on other sites More sharing options...
gleehan Posted February 21, 2007 Report Share Posted February 21, 2007 How would I properly add a menu item to a list of menu items similar to this one right here from genlib.php$menu .= "<li><a href=\"$browserepos_url\"><img src=\"$cms[tngpath]tng_repo.gif\" width=\"20\" height=\"20\" border=\"0\" hspace=\"4\" style=\"vertical-align:middle\" align=\"left\" alt=\"\" />$text[repositories]</a></li>\n";only the new menu item would be a link to the access log, along with PHP code keeping the link from showing up unless someone is logged in as an administrator?I use something like this<?php if( $allow_admin ) echo " <a href=\"showlog.php\" class=\"lightlinkmod\">$text[mnushowlog]</a> \n"; ?>on my home page, but that's a regular link, not something inside an HTML list like one finds on the other pages of template 5. When I tried plopping the line above in between this list tags of the first type of code, it broke genlib (plus, I couldn't find an icon to link to that goes with access log--has anyone ever seen one?). Any thoughts on what I did wrong (which I'm guessing had something to do with PHP inside of PHP)?It's probably easiest to do it the other way 'round... put the new menu item inside an if statement... like$menu .= "<li><a href=\"$bro etc previous menu item...if( $allow_admin ) {$menu .= "<li<a href=\"showlog.php\" class=\"lightlinkmod\">$text[mnushowlog]</a></li>\n";}$menu .= "<li><a href=\"$bro etc next menu item...Then the menu item won't be processed if the user doesn't have admin privilegesAs for admin icons... I've not seen one used, but maybe a picture of a key from google images or your clip art folder would look ok. There are a lot of good icons at http://4umi.com/image/icon/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.