...

View Full Version : Resolved php help



cosmicsea
01-07-2010, 08:07 AM
Hi im trying to turn title names into clickable tags that will search my site. Lets say I have a title called "the boat floats" without the "", but I want the individual words to be different clickable tags like "the" would be its own tag, and "boat" would be its own tag, and "floats" would be its own tag. I made this code right here I will post but i am not sure how to make the words separated into their own clickable tag links. right now the code i am posting will display the whole title as a clickable tag but i want the individual words to be different. Can anybody help me out? Thanks Alot.


<a href="/search/<?php print($link_data['display_name']); ?>"/><?php print($link_data['display_name']); ?></a>

abduraooft
01-07-2010, 08:28 AM
Lets say I have a title called "the boat floats" without the "", but I want the individual words to be different clickable tags like "the" would be its own tag, and "boat" would be its own tag, and "floats" would be its own tag. Let me ask, why? I think your code may end up in a situation like "click here (http://www.w3.org/QA/Tips/noClickHere)"

I think, I misread your post

seco
01-07-2010, 08:30 AM
$title = "the boat floats";
$tags = explode(" ", $title);
foreach( $tags as $key => $value){
echo "<a href='search.php?term=$value'>$value</a> ";
}

and how you want it with seo urls


$title = "the boat floats";
$tags = explode(" ", $title);
foreach( $tags as $key => $value){
echo "<a href=\"/search/$value\"/>$value</a> ";
}

cosmicsea
01-07-2010, 09:00 AM
$title = "the boat floats";
$tags = explode(" ", $title);
foreach( $tags as $key => $value){
echo "<a href='search.php?term=$value'>$value</a> ";
}

and how you want it with seo urls


$title = "the boat floats";
$tags = explode(" ", $title);
foreach( $tags as $key => $value){
echo "<a href=\"/search/$value\"/>$value</a> ";
}

Hey seco thanks alot for your help, with a little editing that worked great! I appreciate your fast response.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum