Current location: Hot Scripts Forums » Programming Languages » PHP » Wow, a dynamic menu, error!


Wow, a dynamic menu, error!

Reply
  #1 (permalink)  
Old 12-30-03, 08:44 PM
Programme Programme is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Wow, a dynamic menu, error!

Hi!

I am currently rewriting my project and this time using templates. I have a menu witch is dynamic. The way it worked was that each menu item had 2 images, on normal image and one image for when that page was active. I had a menu.php file with a number of if statements, one for each page. The if statement would tell the scripts that it was to use the active image instead. The in the like to the page it would have like: stats.php?page=01 and so on, so if page was 01 then the stats button would be active, this for better navigation for users.

No i want to use a tomplate for the menu, but then the menu.php file is deleted and i then have menu.tpl with the menu. The problem now is how to make it like before. I have thought of looping the template and use the variable sent with the link, but i am not sure how i am gonna do this.

I am using TemplatePower at the moment, and hope that someone can give me an idea on how to make this work.

Regards
Endre Myrvang
Reply With Quote
  #2 (permalink)  
Old 12-31-03, 06:45 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
I have done the same thing with my site www.electronicmusicworld.com

what I did was in each img src tag for the menu, I've done:

Code:
<img src="images/news{NEWS}.gif" alt="news" border="0" /><img src="images/articles{ARTICLES}.gif" alt="articles" border="0" /><img src="images/reviews{REVIEWS}.gif" alt="reviews" border="0" />
then in the php files for news, I do:

PHP Code:

$tpl->assign("NEWS""_on"); 

and for articles I do:

PHP Code:

$tpl->assign("ARTICLES""_on"); 

etc

that way, the news_on.gif, articles.gif and reviews.gif are displayed when in news, the articles_on.gif, news.gif and reviews.gif are displayed in articles, etc.

I am also using TemplatePower by the way
Reply With Quote
  #3 (permalink)  
Old 12-31-03, 07:04 AM
Programme Programme is offline
Newbie Coder
 
Join Date: Dec 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Ah, yes of course! I see now what you have done and so simple even! This is why we have forums!!

Thankyou by the way!! And a happy new year!

- Programme
Reply With Quote
  #4 (permalink)  
Old 01-05-04, 02:16 PM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
it's simple, you just have to find the solution... as with every solution

happy new year, and good luck with your script
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help finding a JavaScript Tree menu.. Stunnedmonkey JavaScript 1 08-11-04 10:09 AM
error when creating database tables with php script spiroth10 PHP 4 01-06-04 03:59 PM
php error plz help darkcarnival PHP 2 11-19-03 08:14 PM
Dynamic Navigation Menu! edigitalxp ASP 1 08-01-03 12:35 AM
putting content in a drop down menu tom PHP 7 07-04-03 02:25 PM


All times are GMT -5. The time now is 07:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.