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
Different menu if on certain pages?
Old 01-28-2011, 08:33 AM Different menu if on certain pages?
zomex's Avatar
Ultra Talker

Posts: 308
Name: Jack
Trades: 0
Hello everyone,

I'm using Zen Cart for an online store and I need to display a different menu on certain pages. Of course the whole store's design is controlled by 1 file which is why I'm looking to use PHP for this.

My knowledge of PHP is basically 0 and I've tried to find a solution. I can find the code which will allow me to display code based on 1 page but not multiple pages. The URLS are dynamic e.g index.php?main_page=index&cPath=10 so I hope that's not a problem.

So for example:

If URL is /index.php?main_page=index&cPath=10, /index.php?main_page=index&cPath=8, index.php?main_page=index&cPath=4

display:

<ul>
<li><a href="link.php">Link 1</li>
<li><a href="link.php">Link 2</li>
<li><a href="link.php">Link 3</li>
</ul>

else display:

<ul>
<li><a href="link.php">Link 4</li>
<li><a href="link.php">Link 5</li>
<li><a href="link.php">Link 6</li>
</ul>

I'm also offering $10 via PayPal to anyone who can point me in the right direction

Thanks,
Jack
__________________

Please login or register to view this content. Registration is FREE
- Hosting over 200 websites!


Please login or register to view this content. Registration is FREE
from just $3.99/month

Please login or register to view this content. Registration is FREE
- 20% Lifetime Commissions!
Please login or register to view this content. Registration is FREE

Last edited by zomex; 01-28-2011 at 08:35 AM..
zomex is offline
Reply With Quote
View Public Profile Visit zomex's homepage!
 
 
Register now for full access!
Old 01-28-2011, 10:35 AM Re: Different menu if on certain pages?
madnhain's Avatar
Experienced Talker

Posts: 42
Name: Jez
Location: Grand Junction, CO / Williston, ND
Trades: 0
when going to each of these seperate pages, try passing a content variable to the new page ie: <a href="index.php?content=cPath4>Link to page</a>

Then on each of the individual pages, include something like this:

<?php
if (!isset($_REQUEST['content'])) include("generic_menu.inc.php");
else
{
$content = $_REQUEST['content'];
$menu = $content . ".inc.php";
include($menu);
}
?>

each of your individual menus could be saved as ***.inc.php

or alternatively, a series of "if" statements that display the correct menu based on $_REQUEST['content']

Last edited by madnhain; 01-28-2011 at 10:38 AM..
madnhain is offline
Reply With Quote
View Public Profile
 
Old 01-29-2011, 10:35 AM Re: Different menu if on certain pages?
zomex's Avatar
Ultra Talker

Posts: 308
Name: Jack
Trades: 0
Hello Jez,

Thanks for taking the time to write some code!

The problem is that only 1 file controls the whole design so I only have 1 page to create a different menu on each page of the website

Jack
__________________

Please login or register to view this content. Registration is FREE
- Hosting over 200 websites!


Please login or register to view this content. Registration is FREE
from just $3.99/month

Please login or register to view this content. Registration is FREE
- 20% Lifetime Commissions!
Please login or register to view this content. Registration is FREE
zomex is offline
Reply With Quote
View Public Profile Visit zomex's homepage!
 
Old 01-29-2011, 03:30 PM Re: Different menu if on certain pages?
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
first thing-y u wanna put whole site in single page?
2-as u r doing so u need to use swich case based upon querystring passed with url.
but writing such code for large no of pages is not a good idea. Cuz ur code will get difficult to understand.
Modular approach is alweys have to be followed. So best way is to separate pages accorcing to content.
phazorRise is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Different menu if on certain pages?
 

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.13717 seconds with 12 queries