TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,910
  • Total Topics: 21,307
  • Online today: 705
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 712
  • Total: 713
  • lurkalot

Problem with Menu, Article not listed as current item

Started by kro121, May 29, 2010, 05:47:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kro121

Link to my site: Localhost not live
SMF version: 1.1.11
TP version: 1.5b-1
Theme name and version: Black Rain v1 customized
Browser Name and Version: Firefox 3.6.3
Mods installed: None
Related Error messages: None

The Problem

I am trying to add an article as a menu item. When I select the menu item it goes to the correct page, but the active item is not toggled to the listed menu item, it stays on the Home menu item.

I have searched through these forums as well as googled for help and still have nothing that solves the problem. I even recoded the section and it still does not work. The only thing I can think of is that it is a page= and not action= so it is not toggling the active state, however I am not sure how to change that or if it is the correct problem.

The url end name
index.php?page=Media

A picture of the problem because of no active site:
http://dl.dropbox.com/u/7294829/help1.jpg

The index.template.php file:
http://dl.dropbox.com/u/7294829/index.template.php

Thank you in advance for your help.


kro121

QuoteThe topic or board you are looking for appears to be either missing or off limits to you.

This is what I get when I click on the link.

IchBin

Hmm... I guess Bloc had archived some stuff. Not sure why there's no access so I'll quote it for you. Just replace the number of the article with the name.
Quote from: IchBinâ„¢ on April 01, 2007, 05:18:55 PM
Quote from: Tarren on April 01, 2007, 07:49:59 AM
So I feel there is a relationship between having the "action=" statement displayed in the address and having the menu item contain a highlighted underline when you visit that page.

Is this fixable? 
You are exactly correct. The code will show you this.
When you add the "action" to the array, it assigns $current_action = gallery;
When it does that, you can then look at the button code which shows this:

<td class="maintab_', $current_action == 'gallery' ? 'active_back' : 'back','">

This statement basically says, if $current_action is equal to gallery then class=maintab_active_back, if not then class=maintab_back.

Thats why it works with actions. You can do additional checks if needed.

To check for an article you could do this.
if(isset($_GET('page') && $_GET['page'] == '41') //41 is the article number.
{
$current_action = 'myarticle';
}


Then just change your button code to check for myarticle. At least I think this should work. lol.

kro121

Thank you for your reply. I tried the code and it does not work, however I modded it so that anytime a page is called it selects that button.

Fatal error: Can't use function return value in write context

This is what I get when i entered what was posted. Hope you can help, thanks alot for the assistance IchBin.

edit:

if(isset($_GET['page']))
$current_action = 'media';


This is what I modded and it works for all pages within the menu. The only thing I can think of is that is is missing the call to the exact page name so that I can have multiple pages in the menu.

IchBin

The code I posted above will give you a highlighted button for each individual article. You'll have to add a section of code for each article.

if (isset($_GET['page]) is what looks to see if the word page is in the URL. The  && $_GET['page'] == '41' looks to see if it is equal to 41. Replace the number 41 with what ever the name or id of your article is.

kro121

Thank you for your reply. I figured that was the case, however when I put the code in as


if(isset($_GET['page'] && $_GET['page'] == 'Media')) //41 is the article number.
{
$current_action = 'media';
}


Which is what you suggested to work where as the article name is Media I get the following error


Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\)


with


if(isset($_GET['page'] && $_GET['page'] == 'Media')) //41 is the article number.


As the selected errior code, the error is titled as a template parse error. Again thank you for your help

kro121

I found the problem. I reread your hand written code and mistakenly forgot to add in an additonal ")" after the first get.

Thank you alot IchBin!!!!!

For people's future reference to call a article the code is as follows:


if(isset($_GET['page']) && $_GET['page'] == '41') //41 is the article number or name
{$current_action = 'myarticle';
}

IchBin


This website is proudly hosted on Crocweb Cloud Website Hosting.