HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media


Welcome to TinyPortal. Please login or sign up.

May 28, 2023, 01:59:56 AM

Login with username, password and session length
  • Total Members: 3,864
  • Latest: Joonoz
  • Total Posts: 194,353
  • Total Topics: 21,156
  • Online today: 82
  • Online ever: 3,540
  • (September 03, 2022, 01:38:54 AM)
Users Online
Users: 0
Guests: 89
Total: 89

vertical menu!

Started by gdblaster, October 03, 2006, 07:44:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.


i wanted a vertical menu for my entire portal in the left part and i made it in html (code writen in a tiny portal block). but that menu contains the main parts of the portal! now i want to make an user menu at the top of the page in the user information box! to contain 'profile' 'pms' 'admin' (only for administrators) and 'login', 'logout', 'register' for guests! i tried many times but it didn't work. please help me cause i want to make a good website!

thank you in advance! and some screenshots to see what i'm talking about!


If you want a dynamic menu -- one that changes based on who is looking at it -- you'll need to use a php block.

You can use the code below:
global $context, $scripturl, $txt;

  echo '<a href="'.$scripturl.'?action=profile;u='.$context['user']['id'].'">Profile</a>'; // Profile
  if ($context['allow_pm']){
    echo '<br /><a href="', $scripturl, '?action=pm">' .$txt['tp-pm'].' ', $context['user']['messages'], '</a>'; //Messages
        echo '<br /><a style="font-weight: bold; " href="', $scripturl, '?action=pm">' .$txt['tp-pm2'].' ',$context['user']['unread_messages'] , '</a>'; // New messages
  if ($context['allow_admin'])
    echo '<br /><a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>'; // Admin
  echo '<br /><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>'; // Log out

  echo '<a href="'.$scripturl.'?action=login">' , $txt[34] , '</a>'; // Log in
  echo '<br /><a href="', $scripturl, '?action=register">' , $txt[97] , '</a>'; // Register

This doesn't have any formatting or icons or anything like that in it, but it does have the links, based on whether the user is logged in or not and whether the user is an admin.


thank you for the code ... no problem ... i will add the images ... i will try it and i will tell if it works or not


i added your code and it was a vertical menu (only the links). i added the images and i added align="right" property in img tag. and look what problem i have now! every time i added the code for the menu it was like in the picture

here is the code:

// If the user is logged in, display stuff like their name, new messages, etc.
if ($context['user']['is_logged'])

//Testing Menu
if ($context['allow_edit_profile'])
echo '<a href="'.$scripturl.'?action=profile;u='.$context['user']['id'].'">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/menu/profile.gif" alt="Edit Profile""' . $txt[79] . '" style="margin: 2px 0;" align="right" border="0" />' : $txt[467]), '</a>'; // Profile

  if ($context['allow_pm'])
  echo '<br /><a href="', $scripturl, '?action=pm">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/im_new.gif" alt="View Messages""' . $txt[79] . '" style="margin: 2px 0;" align="right" border="0" />' : $txt[467]), '</a>'; //Messages
  if ($context['allow_admin'])
    echo '<br /><a href="', $scripturl, '?action=admin">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/menu/administrator.gif" alt="Administration Panel""' . $txt[79] . '" style="margin: 2px 0;" align="right" border="0" />' : $txt[2]), '</a>'; // Admin

  echo '<br /><a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/menu/logout.gif" alt="Log Out""' . $txt[108] . '" style="margin: 2px 0;" align="right" border="0" />' : $txt[108]), '</a>'; // Log out

// Welcomes Logged User!
echo '
', $txt['hello_member'], ' <b>', $context['user']['name'], '</b>';

// Only tell them about their messages if they can read their messages!
if ($context['allow_pm'])
echo ', ', $txt[152], ' <a href="', $scripturl, '?action=pm">', $context['user']['messages'], ' ', $context['user']['messages'] != 1 ? $txt[153] : $txt[471], '</a>', $txt['newmessages4'], ' ', $context['user']['unread_messages'], ' ', $context['user']['unread_messages'] == 1 ? $txt['newmessages0'] : $txt['newmessages1'];
echo '.<br />';

// Is the forum in maintenance mode?
if ($context['in_maintenance'] && $context['user']['is_admin'])
echo '
<b>', $txt[616], '</b><br />';

// Are there any members waiting for approval?
if (!empty($context['unapproved_members']))
echo '
', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '<br />';

// Show the total time logged in?
if (!empty($context['user']['total_time_logged_in']))
echo '
', $txt['totalTimeLogged1'];

// If days is just zero, don't bother to show it.
if ($context['user']['total_time_logged_in']['days'] > 0)
echo $context['user']['total_time_logged_in']['days'] . $txt['totalTimeLogged2'];

// Same with hours - only show it if it's above zero.
if ($context['user']['total_time_logged_in']['hours'] > 0)
echo $context['user']['total_time_logged_in']['hours'] . $txt['totalTimeLogged3'];

// But, let's always show minutes - Time wasted here: 0 minutes ;).
echo $context['user']['total_time_logged_in']['minutes'], $txt['totalTimeLogged4'], '<br />';
echo '
<a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a><br />
<a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a><br />', $context['current_time'];


I added your code and it was a vertical menu (only the links)
Which is what you asked for.

I'm sorry. I thought you wanted a vertical menu in a block that had the user controls, which would be like the vertical menu you already made. Now that I read what you wrote again, I see that you said, "in the user information box."

I'm not that great with css, but instead of
style="margin: 2px 0;" align="right" border="0" />
you might try
style="margin: 2px 0; float:right; border-style:none:" />


i made it ... i created another column of the table (cause until now it had 2 columns - 1 for avatar and another for information) and i used your code and it's perfect now! thank you! maybe i will write here the code but later :D