Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Include menu file & set the variables for current state
Old 10-05-2009, 04:27 PM Include menu file & set the variables for current state
Junior Talker

Posts: 3
Name: Marta Frank
Trades: 0
Hi everybody


I have a menu.php file included in my web... The question is how do i set variables for the various pages? I have a css class (current state) i want to hide & show depending on the page you are on.

Thanks!
Hand2Mouth is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-05-2009, 09:07 PM Re: Include menu file & set the variables for current state
bmcoll3278's Avatar
Super Talker

Posts: 118
Name: Brian Collins
Trades: 0
try these they look like what you need.
http://www.willmaster.com/blog/css/s...oating-div.php

http://www.netlobo.com/div_hiding.html

I think this is what you want if not post mor info and a link to your page so we can see it.
__________________
I hope to build a site with something for every one

Please login or register to view this content. Registration is FREE
bmcoll3278 is offline
Reply With Quote
View Public Profile Visit bmcoll3278's homepage!
 
Old 10-07-2009, 02:54 PM Re: Include menu file & set the variables for current state
Junior Talker

Posts: 3
Name: Marta Frank
Trades: 0
I was talking about PHP include.

In the document:

<?php include(“includes/navigation.php”);?>


<body<?php $pageName = "Home"; ?>>
<ul id="nav">
<li><a href="#" <?php if ($pageName=="Home") echo 'id="current"'; ?>>HOME</a></li>
<li><a href="#" <?php if ($pageName=="About") echo 'id="current"'; ?>>ABOUT</a></li>
<li><a href="#" <?php if ($pageName=="Contact") echo 'id="current"'; ?>>CONTACT</a></li>
</ul>
</body>

Something like this...
Hand2Mouth is offline
Reply With Quote
View Public Profile
 
Old 10-08-2009, 04:57 AM Re: Include menu file & set the variables for current state
lizciz's Avatar
Webmaster Talker

Posts: 744
Name: Mattias Nordahl
Location: Sweden
Trades: 0
Add a declaration of $pageName in the top of all the pages. On your "Home"page, add

PHP Code:
<?php
   $pageName 
"Home";
   include(
"includes/navigation.php");
?>
On your "About" page, add

PHP Code:
<?php
   $pageName 
"About";
   include(
"includes/navigation.php");
?>
and so on.
__________________
34343639363436653237373432303635373837303635363337 34323037343638363137343263323036343639363432303739 366637353366
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Reply     « Reply to Include menu file & set the variables for current state
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16512 seconds with 12 queries