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
  1. #1
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts

    Question removing keyword

    im using this code right here on some automated links of mine for seo to explode the caption of the links but i want to be able to make one word that is in the links that explodes into its own link to not show.
    PHP Code:
    <?php $tagss explode(" "$link['display_name']);
                foreach( 
    $tagss as $key => $value){
                echo 
    "<a href=\"/search/$value\"/>$value</a> ";
                } 
    ?>
    lets say the link caption is "automated link caption". the code above explodes that into 3 seperate links. link 1 "automated" link 2 "link" link 3 "caption". so now that you see what im talking about how can i make one of those not display? lets say i dont want "caption" to ever display. how would i do that? Can anyone help? thanks.
    Last edited by cosmicsea; 01-14-2010 at 11:56 AM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    PHP Code:
    $tobeOmitted=array('caption','something');
    foreach( 
    $tagss as $key => $value){
    if(!
    in_array($value,$tobeOmitted))
    echo 
    "<a href=\"/search/$value\"/>$value</a> ";

    ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    cosmicsea (01-14-2010)

  • #3
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by abduraooft View Post
    PHP Code:
    $tobeOmitted=array('caption','something');
    foreach( 
    $tagss as $key => $value){
    if(!
    in_array($value,$tobeOmitted))
    echo 
    "<a href=\"/search/$value\"/>$value</a> ";

    ?
    that doesn't seem to be working.
    "actually hold on i just noticed a typo when i entered the code. i will reply in a minute".
    Last edited by cosmicsea; 01-14-2010 at 11:51 AM. Reason: typo

  • #4
    Regular Coder
    Join Date
    Jan 2010
    Location
    Washington
    Posts
    223
    Thanks
    34
    Thanked 0 Times in 0 Posts
    ok, It does work and it works great! thanks alot!


  •  

    Posting Permissions

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