Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: php help

  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts

    php help

    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.

    Code:
    <a href="/search/<?php print($link_data['display_name']); ?>"/><?php print($link_data['display_name']); ?></a>
    Last edited by cosmicsea; 01-07-2010 at 08:03 AM. Reason: resolved

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,801
    Thanks
    160
    Thanked 2,216 Times in 2,203 Posts
    Blog Entries
    1
    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"

    Edit: I think, I misread your post
    Last edited by abduraooft; 01-07-2010 at 07:52 AM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts
    PHP Code:
    $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

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

    Last edited by seco; 01-07-2010 at 07:35 AM.

  • Users who have thanked seco for this post:

    cosmicsea (01-07-2010)

  • #4
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by seco View Post
    PHP Code:
    $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

    PHP Code:
    $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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •