Jump to content

Help with navigation


dc_jt

Recommended Posts

Hi Ive got a navigation which has 3 tiers. I want to show certain tiers depending on what page I am on.

 

1. Our Projects

          Category Name

                  Project Name

          Category Two Name

                  Project Two Name

                  Project Three Name

 

etc etc...

 

The idea is that at first only 'Our Projects' is shown.

 

When you click this and go to the /projects/ page, the 'Category Name' and 'Category Name Two' will appear.

 

When you click a category e.g 'Category Name' this will take you to /projects/our-projects.php?iCategoryId=1 and the projects for this category will appear (in this case 'Project Name').

 

When you click a project e.g. Project Name, you are taken to the projects/centre.php?iCentresId=1 page and the categories and projects for this category are still shown.

 

The way I have done it works, however when I click the actual project, it hides the project in the dropdown.

 

Hope all this makes sense, I have tried to describe as best as I could.

 

Please see below for what Ive done so far.

 

$d=explode("/",$_SERVER[sCRIPT_NAME]);
$file=($d [1]);
$file2 = ($_SERVER[sCRIPT_NAME]);
$url = $_SERVER['REQUEST_URI'];

<li><a href="/projects/" accesskey="N">Our Projects</a>
        <?php if($file == 'projects'){?>
        <ul>

        <?php
			while ($oCategories = mysql_fetch_object($rCategories))
			{?>
      	<li><a href="/projects/our-projects.php?iCategoryId=<?=$oCategories->category_id?>" accesskey="P"><?=$oCategories->category?></a>
        	
      	<?php 
                	$rCentresArticles = $oTblCentres->GetArticles($iStart, 500, $oCategories->category_id);
                	if($url == '/projects/our-projects.php?iCategoryId='.$oCategories->category_id.''){?>
      			<ul>

                	<?php
				while ($oCentresArticle = mysql_fetch_object($rCentresArticles))
				{
					if($url == '/projects/centre.php?iCentresId='.$oCentresArticle->centres_id.'' || $url == '/projects/our-projects.php?iCategoryId='.$oCategories->category_id.''){?>
				<li><a href="/projects/centre.php?iCentresId=<?=$oCentresArticle->centres_id ?>"><?=$oCentresArticle->title?></a></li>
				<?php }?>
				<?php }?>
        	</ul>
        	<?php }?>
        </li>
        <?php }?>
        </ul>
        <?php }?>

 

Thanks

Link to comment
Share on other sites

Update :

I now have the following which works, although when I click on a project it only shows that project and not all projects for that category in the nav.

 

Any ideas of how I can change this to still show all projects for the category. I know its because Ive put

($url == '/projects/centre.php?iCentresId='.$oCentresArticle->centres_id

but I dont know how else to do it?

 

Thanks

 

<li><a href="/projects/" accesskey="N">Our Projects</a>
        <?php if($file == 'projects'){?>
        <ul>

        <?php
			while ($oCategories = mysql_fetch_object($rCategories))
			{?>
      	<li><a href="/projects/our-projects.php?iCategoryId=<?=$oCategories->category_id?>" accesskey="P"><?=$oCategories->category?></a>
        	
      	<?php 
                	$rCentresArticles = $oTblCentres->GetArticles($iStart, 500, $oCategories->category_id);

                	if($url == '/projects/our-projects.php?iCategoryId='.$oCategories->category_id.'' || $file2 == '/projects/centre.php'){?>
      		

                	<?php
                	$iCount=0;
				while ($oCentresArticle = mysql_fetch_object($rCentresArticles))
				{?>
				<?php if($url == '/projects/centre.php?iCentresId='.$oCentresArticle->centres_id || $url == '/projects/our-projects.php?iCategoryId='.$oCategories->category_id.''){?>
				<? 
				$iCount++;
				if ($iCount == '1'){
					echo "<ul>";
				}?>
				<li><a href="/projects/centre.php?iCentresId=<?=$oCentresArticle->centres_id ?>"><?=$oCentresArticle->title?></a></li>
				<?php }?>
				<?php }?>
				<? if ($iCount >= '1'){
					echo "</ul>";	
				}?>

        	<?php }?>

        </li>
        <?php }?>
        </ul>
        <?php }?>
        
        </li>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.