Re: Rewriting string

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

 



Try this. 
After you create the array

If(in_array($_GET['page'],$categorys)){

}else{

}



Sent from my iPhone

On Jan 13, 2011, at 5:09 AM, David McGlone <david@xxxxxxxxxxxxx> wrote:

> Hi everyone,
> 
> I think the subject is right, or somewhere close. Anyway I am trying to 
> perform a little trickery here with links. In the following code you can see 
> where I am trying to replace the link on the current page so it's not a link 
> when on that page. I think I got the general idea of what I need to do as you 
> can see in the code I just don't know how to accomplish it, if it's possible.
> 
> 
> $categorys = array('home', 'services', 'gallery', 'about_us', 'contact_us', 
> 'testimonials');
> foreach($categorys as $category){
> $deadlink = $_GET['page'];
> 
> if ($deadlink == 'page') {
> 
> $replace = str_replace("_", " ", $category); 
> echo "<li>$deadlink</li>";
> 
> } else {
> 
> $replace = str_replace("_", " ", $category); 
> echo "<li><a href='index.php?page=$category'>$replace</a></li>";
> 
> }
> -- 
> Blessings
> David M.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

-- 
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