News:

Follow us on Bluesky!

Main Menu

"Menu" Buttons

Started by iBuG, August 05, 2010, 06:47:28 PM

Previous topic - Next topic

iBuG

Well , talking about menu buttons since i cant add it.
I have downloaded some Modifications for it but its still dont work.

Im using forum smf 1.1 www . lost - souls . tk


// Show the menu up top. Something like [home] [help] [profile] [logout]...
function template_menu()
{
   global $context, $settings, $options, $scripturl, $txt;

   // Work out where we currently are.
   $current_action = 'home';
   if (in_array($context['current_action'], array('admin', 'ban', 'boardrecount', 'cleanperms', 'detailedversion', 'dumpdb', 'featuresettings', 'featuresettings2', 'findmember', 'maintain', 'manageattachments', 'manageboards', 'managecalendar', 'managesearch', 'membergroups', 'modlog', 'news', 'optimizetables', 'packageget', 'packages', 'permissions', 'pgdownload', 'postsettings', 'regcenter', 'repairboards', 'reports', 'serversettings', 'serversettings2', 'smileys', 'viewErrorLog', 'viewmembers')))
      $current_action = 'admin';
   if (in_array($context['current_action'], array('search', 'forum', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm')))
      $current_action = $context['current_action'];
   if ($context['current_action'] == 'search2')
      $current_action = 'search';

   if ($context['current_action'] == 'theme')
      $current_action = isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'pick' ? 'profile' : 'admin';

   // Are we using right-to-left orientation?
   if ($context['right_to_left'])
   {
      $first = 'last';
      $last = 'first';
   }
   else
   {
      $first = 'first';
      $last = 'last';
   }


   // Show the start of the tab section.
   echo '
      <ul>';
     
         // Show the [home] button.
         echo '<li><a' , $current_action=='home' ? ' class="current"' : '' , ' href="', $scripturl, '"><span>' , $txt[103] , '</span></a></li>';


         // Show the [Forum] button.
         echo '<li><a' , $current_action=='forum' ? ' class="current"' : '' , ' href="', $scripturl, '?action=forum"><span>' , $txt['forum']='Forum' , '</span></a></li>';

         // How about the [search] button?
         if ($context['allow_search'])
         echo '<li><a' , $current_action=='search' ? ' class="current"' : '' , ' href="', $scripturl, '?action=search"><span>' , $txt[182] , '</span></a></li>';

         // The [calendar]!
         if ($context['allow_calendar'])
         echo '<li><a' , $current_action=='calendar' ? ' class="current"' : '' , ' href="', $scripturl, '?action=calendar"><span>' , $txt['calendar24'] , '</span></a></li>';

         // Is the user allowed to administrate at all? ([admin])
         if ($context['allow_admin'])
         echo '<li><a' , $current_action=='admin' ? ' class="current"' : '' , ' href="', $scripturl, '?action=admin"><span>' , $txt[2] , '</span></a></li>';

         // Edit Profile... [profile]
         if ($context['allow_edit_profile'])
         echo '<li><a' , $current_action=='profile' ? ' class="current"' : '' , ' href="', $scripturl, '?action=profile"><span>' , $txt[79] , '</span></a></li>';

         // Go to PM center... [pm]
         if ($context['user']['is_logged'] && $context['allow_pm'])
         echo '<li><a' , $current_action=='pm' ? ' class="current"' : '' , ' href="', $scripturl, '?action=pm"><span>' , $txt['pm_short'] , '</span></a></li>';

         // the [member] list button
         if ($context['allow_memberlist'])
         echo '<li><a ' , $current_action=='mlist' ? ' class="current"' : '' , ' href="', $scripturl, '?action=mlist"><span>' , $txt[331] , '</span></a></li>';

         // If the user is a guest, show [login] button.
         if ($context['user']['is_guest'])
         echo '<li><a ' , $current_action=='login' ? ' class="current"' : '' , ' href="', $scripturl, '?action=login"><span>' , $txt[34] , '</span></a></li>';

         // If the user is a guest, also show [register] button.
         if ($context['user']['is_guest'])
         echo '<li><a ' , $current_action=='register' ? ' class="current"' : '' , ' href="', $scripturl, '?action=register"><span>' , $txt[97] , '</span></a></li>';

         // Otherwise, they might want to [logout]...
         if ($context['user']['is_logged'])
         echo '<li><a ' , $current_action=='logout' ? ' class="current"' : '' , 'href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '"><span>' , $txt[108] , '</span></a></li>';

   echo '
      </ul>';
}




Its the code for show "Forum" Button . But i want add there "Rules" and "Info".
So i need just edit it?

Kill Em All

What mod did you install? Are you using a custom theme?


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

iBuG

DarkBreak by DzinerStudio

Hj Ahmad Rasyid Hj Ismail

Quote from: iBuG on August 05, 2010, 06:47:28 PM
Its the code for show "Forum" Button . But i want add there "Rules" and "Info".
So i need just edit it?
Yes just edit it and add something like this where you wanted it to be in between your given menu code above. (I never tested this code).
         // Show the [rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTRULESLINKHERE"><span>Rules</span></a></li>';


         // Show the [info] button.
         echo '<li><a' , $current_action=='info' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTINFOLINKHERE"><span>Info</span></a></li>';

iBuG

But how can i add something in the "Rules" .
I need add rules action where?

Kill Em All

iBuG, did you look at ahrasis's post? He gave you the code:

         // Show the [rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTRULESLINKHERE"><span>Rules</span></a></li>';


         // Show the [info] button.
         echo '<li><a' , $current_action=='info' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTINFOLINKHERE"><span>Info</span></a></li>';
[/url]

Just replace PLACETHECORRECTINFOLINKHERE with its action. Look at your current buttons for examples.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

iBuG

Yeah , i did.

I have fixed it already .
But when i click to the "Rules" Button there are nothing to see .

Hj Ahmad Rasyid Hj Ismail

Quote from: iBuG on August 05, 2010, 08:25:39 PM
But how can i add something in the "Rules" .
I need add rules action where?
We normally use registration rules as the rules but you can also link it to your post e.g. this topic link. So you change ?PLACETHECORRECTRULESLINKHERE with this ?topic=394438

Quote from: iBuG on August 05, 2010, 08:42:10 PM
Yeah , i did.

I have fixed it already .
But when i click to the "Rules" Button there are nothing to see .
With what link did you fix it?

iBuG



There you can check it url of Rules topic in my forum .

And im trying to using  // Show the [Rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?action=topic6.0"><span>' , $txt['topic6.0']='Rules' , '</span></a></li>';


But its not work

Hj Ahmad Rasyid Hj Ismail

You are not following my code and created your own with a lot of mistakes. This is the code that I have given you.
Quote from: ahrasis on August 05, 2010, 07:28:08 PM
Yes just edit it and add something like this where you wanted it to be in between your given menu code above. (I never tested this code).
         // Show the [rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTRULESLINKHERE"><span>Rules</span></a></li>';


         // Show the [info] button.
         echo '<li><a' , $current_action=='info' ? ' class="current"' : '' , ' href="', $scripturl, '?PLACETHECORRECTINFOLINKHERE"><span>Info</span></a></li>';

I had exactly mentioned how to change it if you use topic link instead.
Quote from: ahrasis on August 05, 2010, 08:44:17 PM
We normally use registration rules as the rules but you can also link it to your post e.g. this topic link. So you change ?PLACETHECORRECTRULESLINKHERE with this ?topic=394438
Yet you do this:
Quote from: iBuG on August 05, 2010, 08:56:36 PM
There you can check it url of Rules topic in my forum .

And im trying to using  // Show the [Rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?action=topic6.0"><span>' , $txt['topic6.0']='Rules' , '</span></a></li>';


But its not work
Your mistake above is in this part: ['?action=topic6.0"><span>' , $txt['topic6.0']='Rules' , '</span></a></li>';] which suppose to be like this:
         // Show the [rules] button.
         echo '<li><a' , $current_action=='rules' ? ' class="current"' : '' , ' href="', $scripturl, '?topic=6.0"><span>Rules</span></a></li>';

Kill Em All

ahrasis, this method would probably be much easier:

         // Show the [rules] button.
         echo '<li><a href="http://yoursite.com/index.php?topic=4.0"><span>Rules</span></a></li>';


Jut add that code instead. Just put the link of the topic in there.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Hj Ahmad Rasyid Hj Ismail

Quote from: Kill Em All on August 05, 2010, 09:09:09 PM
ahrasis, this method would probably be much easier:

         // Show the [rules] button.
         echo '<li><a href="http://yoursite.com/index.php?topic=4.0"><span>Rules</span></a></li>';


Jut add that code instead. Just put the link of the topic in there.
Yes. It's the same but only hardcoded. I'm afraid your must explain changing that yoursite.com so he change it. Otherwise.. you know what i mean...  ;D

Kill Em All

Very good point. TBH, I don't care if stuff is hardcoded, I know a lot of coders do though. It just doesn't bother me though.

And yeah, I prob should have.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

iBuG

Also i have problem with.
You're on a windows server, and some crucial files are not writable. Please ask your host to give write permissions  to the user PHP is running under for the files in your SMF installation. The following files or directories need to be writable:

    * attachments
    * avatars
    * Packages
    * Packages/installed.list
    * Smileys
    * Themes
    * agreement.txt
    * Settings.php
    * Settings_bak.php

Click here to try this step again.





I need talk with the hosting or?

Hj Ahmad Rasyid Hj Ismail

You said so:  ;D
Quote from: iBuG on August 06, 2010, 02:56:53 AM
Also i have problem with.
You're on a windows server, and some crucial files are not writable. Please ask your host to give write permissions  to the user PHP is running under for the files in your SMF installation. The following files or directories need to be writable:
Btw, is this problem solved? You can mark it as solved by clicking the button below, if your problem is solved.

iBuG

How can i add there smth like no topic in forum , i mean smth like the test like is if you click to "search".

Kill Em All

smth? What does that mean?

Can you please be more specific.


My Site: KEAGaming.com

Manual Installation of Mods
Prevent Spam and Forum Attacks
Please do not PM or email me for support unless offered, help should be publicly displayed to others.

Advertisement: