TinyPortal

Development => Support => Topic started by: raenk on October 01, 2006, 12:35:39 AM

Title: Issue with editing entries on top menu bar
Post by: raenk on October 01, 2006, 12:35:39 AM
Hi,

I'm havingo minor issues with the top menu bar.

I added a "downloads" item ("descargas" in spanish) and edit the forum entry so it picked the variable tp-forum2 set in TPortal.

1.- Browsing the site, while in the downloads section, the button won't highlight when active.
2.- The Forum entry is not picking up the correct variable value (FOROS) instead is displaying the text "FORUM"

Here's the code:

// 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', 'downloads', 'admin', 'calendar', 'profile', 'register', 'login', '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';

// Dummy place holder, to set the height
echo'
<td align="center" class="menubg" height="30" width="20">
</td>';

// Show the [home] button.
echo'
<td align="center" class="menubg' , $current_action == 'home' ? '2' : '' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>';
// Show the [forum] button.
echo'
<td align="center" class="menubg' , $current_action == 'forum' ? '2' : '' , '">
<a href="', $scripturl, '?action=forum">' , $txt['tp-forum2'] , '</a>
</td>';
// Show the [downloads] button.
echo'
<td align="center" class="menubg' , $current_action == 'downloads' ? '2' : '' , '">
<a href="', $scripturl, '?action=tpmod;dl">DESCARGAS</a>
</td>';

// Show the [help] button.
// echo'
// <td align="center" class="menubg' , $current_action == 'help' ? '2' : '' , '">
// <a href="', $scripturl, '?action=help">' , $txt[119] , '</a>
// </td>';
// How about the [search] button?
if ($context['allow_search'])
echo'
<td align="center" class="menubg' , $current_action == 'search' ? '2' : '' , '">
<a href="', $scripturl, '?action=search">' , $txt[182] , '</a>
</td>';
// Is the user allowed to administrate at all? ([admin])
if ($context['allow_admin'])
echo'
<td align="center" class="menubg' , $current_action == 'admin' ? '2' : '' , '">
<a href="', $scripturl, '?action=admin">' , $txt[2] , '</a>
</td>';
// Edit Profile... [profile]
if ($context['allow_edit_profile'])
echo'
<td align="center" class="menubg' , $current_action == 'profile' ? '2' : '' , '">
<a href="', $scripturl, '?action=profile">' , $txt[79] , '</a>
</td>';
// Go to PM center... [pm]
if ($context['user']['is_logged'] && $context['allow_pm'])
echo'
<td align="center" class="menubg' , $current_action == 'pm' ? '2' : '' , '">
<a href="', $scripturl, '?action=pm">' , $txt['pm_short'] , ' ', $context['user']['unread_messages'] > 0 ? '[<strong>'. $context['user']['unread_messages'] . '</strong>]' : '' , '</a>
</td>';
// The [calendar]!
if ($context['allow_calendar'])
echo'
<td align="center" class="menubg' , $current_action == 'calendar' ? '2' : '' , '">
<a href="', $scripturl, '?action=calendar">' , $txt['calendar24'] , '</a>
</td>';
// the [member] list button
// if ($context['allow_memberlist'])
// echo'
// <td align="center" class="menubg' , $current_action == 'mlist' ? '2' : '' , '">
// <a href="', $scripturl, '?action=mlist">' , $txt[331] , '</a>
// </td>';
// If the user is a guest, show [login] button.
if ($context['user']['is_guest'])
echo'
<td align="center" class="menubg' , $current_action == 'login' ? '2' : '' , '">
<a href="', $scripturl, '?action=login">' , $txt[34] , '</a>
</td>';
// If the user is a guest, also show [register] button.
if ($context['user']['is_guest'])
echo'
<td align="center" class="menubg' , $current_action == 'register' ? '2' : '' , '">
<a href="', $scripturl, '?action=register">' , $txt[97] , '</a>
</td>';
// Otherwise, they might want to [logout]...
if ($context['user']['is_logged'])
echo'
<td align="center" class="menubg' , $current_action == 'logout' ? '2' : '' , '">
<a href="', $scripturl, '?action=logout;sesc=', $context['session_id'], '">' , $txt[108] , '</a>
</td>';


// Dummy place holder, to end things
echo'
<td align="center" class="menubg" width="20">
</td>';
}


I'm using a theme mod based on Dilber MC, here's my site www.redhw.com

Thanks

Title: Re: Issue with editing entries on top menu bar
Post by: G6Cad on October 01, 2006, 01:00:03 AM
you have to add the button name in to the array code aswell :)

if (in_array($context['current_action'], array('search', 'admin', 'your button name here', 'calendar',

Add the button name there and see if it helps
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 01, 2006, 01:03:38 AM
Thanks for your reply.

I have them in to the array code:
if (in_array($context['current_action'], array('search', 'forum', 'downloads', 'admin', 'calendar', 'profile', 'register', 'login', 'pm')))
$current_action = $context['current_action'];


Second and third there.


Title: Re: Issue with editing entries on top menu bar
Post by: G6Cad on October 01, 2006, 01:09:32 AM
Then im lost...

What you can try is to make a text $txt['dl_spain']
and put that in the buttoncode instead of make the link like you have there. If you create a text for it to call from the index.english.php it might work, Although you will have the code the exact same way as the others

The text code you have to add to the index.english.php in the language folder will be like this if you use the example i gave you
$txt['dl_spain'] = 'DESCARGAS';
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 01, 2006, 01:26:30 AM
I added two custom variable for those items. Now the forum variable is picking up, but still no luck with the highlighting on downloads (DESCARGAS) while in it.

Any ideas ?

Thanks Mrs G6
Title: Re: Issue with editing entries on top menu bar
Post by: G6Cad on October 01, 2006, 10:54:26 AM
one last idea, did you add the textstring to your index.yourlanguage.php to ?  or just the index.english.php ?

i know it have some thing to with the "url" part of the code, it needs to have the exact frase and url in order to work 100% with the images
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 01, 2006, 10:34:10 PM
Yep, the textstring is there, actually i didn't add them to index.english.php, just spanish one

Still no luck with it

thanks
Title: Re: Issue with editing entries on top menu bar
Post by: akulion on October 02, 2006, 01:24:30 AM
Try this:

in your array instead of 'downloads' use 'tpmod;dl'

Same in your button and see if it works
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 02, 2006, 03:06:28 AM
Thanks for replying.

I tried what you suggested (akulion), no luck yet.

I haven't said that while in the "downloads" (DESCARGAS) section the button that highlights is "home" (INICIO).

Maybe that tells you something

Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 03, 2006, 05:40:40 PM
So nobody knows anything about this ?

Now i also notice that when inside any other section if you go to a sub-section the highlight fallsback to "HOME".

Like if you move around inside ADMIN it will lost its highlight

Im starting to think this is more like a tiny irrelevant little bug, but would be nice having it working normally
Title: Re: Issue with editing entries on top menu bar
Post by: G6Cad on October 03, 2006, 06:11:23 PM
I dont remember what button code you had there.
But check the code, and if this line is there

if ($context['allow_downloads'])

remove it from the code and check if it works
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 03, 2006, 06:51:46 PM
Thanks Mrs G6

The code is in my first post, and no, that line is not there
Title: Re: Issue with editing entries on top menu bar
Post by: akulion on October 03, 2006, 07:25:48 PM
the admin tag can be easily fixed

u have declared it 2 times, so remove one entry

as for the downloads one, i dont know whats causing this since u have the correct code there...im still looking though
Title: Re: Issue with editing entries on top menu bar
Post by: akulion on October 03, 2006, 07:31:05 PM
just another suggestion...

after this bit of code:


if ($context['current_action'] == 'search2')
$current_action = 'search';


try adding this:


if ($context['current_action'] == 'tpmod;dl')
$current_action = 'downloads';
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 03, 2006, 08:45:19 PM
Admin is fixed now, but i forgot to mention that with forums happens the same, while in the board index (url being 'action=forum') the button highlights correctly, but when inside a topic (url being 'board=1.0') the highlight falls back to HOME. This seems obvious since it lose the current action condition, but I dont know how to specify a general condition about the 'board' item.

The 'downloads' issue remains the same. What you suggested make a lot of sense, but isnt picking up.

Thanks
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 03, 2006, 08:53:15 PM
Ok, I got it, finally.

I changed 'tpmod;dl' to 'tpmod'.

Somehow I became suspicious that maybe that ; could be causing the problem since it's used to end the sentences/declarations or whatever (really dont know anything about php)

Admin and downloads fixed, one more to go (Forums)
Title: Re: Issue with editing entries on top menu bar
Post by: akulion on October 03, 2006, 08:58:30 PM
topics is because I believe you are missing this:


if (isset($_GET['board']) || isset($_GET['topic']))
$current_action = 'forum';



Add the above BELOW the following code:


if ($context['current_action'] == 'search2')
$current_action = 'search';


and see if it fixes it
Title: Re: Issue with editing entries on top menu bar
Post by: raenk on October 03, 2006, 09:00:40 PM
Yep, everything is fixed now.

Thanks akulion !
Title: Re: Issue with editing entries on top menu bar
Post by: akulion on October 03, 2006, 09:01:02 PM
ur welcome :up: