Jump to content
TNG Community

Adding a menu list item


Paul Wake

Recommended Posts

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)?

Link to comment
Share on other sites

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 privileges

As 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/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...