Jump to content

newbie help please


brian914

Recommended Posts

I pretty much know no php, but am redesigning a site that was built in php. The php on the site is super simple and I am trying to add to it a little bit.

 

All the pages in this site have their own page, meaning my about page has an about.php, home has index.php, etc. I am trying to set my navigation so when I am on that page for the navigation to show the page you are on. So, I would like to do something like this:

 

On each of the pages, I would set my page variable just before the include tag of the navigation, something like this:

<?php $thisPage = 'deathValley'; ?>

 

Then in the navigation php file, I would test for my page like so? But I guess you can't use html with php like that? How would I write this?

 

<?php
<ul>	
    <li>
    	{if mypageVariable == deathValley}
            <a id="uberlink2" href="#">DeathValley</a>
        {if:else}
            <a href="bio_deathvalley.php">DeathValley</a>
{/if}
    </li>
</ul>
?>

 

Also, is there a way to test for the url of the page, or something else? That way I would not have to set the variable on each page?

 

Thanks a lot for any help with this!

 

 

 

 

Link to comment
Share on other sites

Your navigation is very confusing. You may want to set up index.php to use GET for navigation. Menu.php could be separate but included.

 

index.php?page=about

index.php?page=bio

index.php?page=DeathValley

 

That's what most sites do. In menu.php or your page if you want..

 

<?php
<ul>   
    <li>
         if($_GET['page']=="DeathValley") {
            echo '<a id="uberlink2" href="?page=DeathValley">DeathValley</a>';
        }elseif($_GET['page']=='About'){
            echo '<a href="?page=About">About</a>';
    </li>
</ul>
?>

Seems like a much more viable option.. but I have no clue what you're doing, your navi is very obscure, your links aren't making any sense to me..

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.