Re: tabbed navegation PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You've not quite caught the trick of the difference between == and =

if ($page_name = 'default')

does not TEST $page_name -- It changes it, and then returns the new
value.

So, pretty much, your $page_name will ALWAYS be 'default' after you
hit this line, no matter what it started out as.

When in doubt about a script, toss in some:

echo $page_name;

statements here and there, to see if the variables are what you think
they are.

This usually lets you narrow down pretty quickly where things are
wrong, and then the why part is usually fairly simple.

... Though I confess I just blew half a day figuring out that:
<script type="text/javascrpt">
was not right. :-(
[note spelling]

Must have read that line 100 times in the course of the day, trying to
figure out why the alert('hello'); right after it wasn't working. :-(

Firefox, Firebug, HTMLValidator...

Not one of them bothered to tell me "unknown type" :-(


On Fri, March 30, 2007 8:05 am, Dwayne Heronimo wrote:
> Dear All,
>
> I have made a tabbed navegation with CSS. And if you set
> class="active" to
> one of the tabs, it will then be highlighted.
> So I thought to make this dymamic with PHP. Using the $_GET variable I
> can
> get the page name above with something like. $page_name =
> $_GET['page'] ;
> so I can tell the class when to be active to what page.
>
> Should I use the isset function for this? I am very new to PHP but
> here is
> my try, but of course its not working:
>
> <?php
> if (isset ($_GET['page'])) {
>
>  $page_name = $_GET['page'] ;
>
>   if ($page_name = "default") {
>    $flg_page_default=1;
>   }
>   if ($page_name = "about") {
>    $flg_page_about=1;
>   }
>
> }
> ?>
>
>
>
> <a <?php if(!isset($flg_page_default)) echo 'class="active"'; else
> echo '';
> ?> href="index.php?page=default"><span>home</span></a>
> <a <?php if(!isset($flg_page_about)) echo 'class="active"'; else echo
> ''; ?>
> href="index.php?page=default"><span>about</span></a>
>
>
> Of should I stick to just static html :(
>
> Dwayne
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux