Using anchor in php [ How ] ?

Discussion in 'PHP' started by Prog4rammer, Oct 11, 2010.

  1. #1
    Hello every guys :)

    How can used the anchor in php ?
     
    Prog4rammer, Oct 11, 2010 IP
  2. Zeh.

    Zeh. Peon

    Messages:
    57
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ? .
     
    Zeh., Oct 11, 2010 IP
  3. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    I don't get the question. PHP can print out any html text, so:
    echo '<a href="mysite.com">anchor text</a>';

    is the same as writing html:
    <a href="mysite.com">anchor text</a>

    if you need some variable to put in you could define the variables (that could come from somewhere):

    $myurl='myurl.com';
    $anchortext='anchor text';

    and then write:

    echo '<a href="'.$myurl.'">'.$anchortext.'</a>';
     
    max2010, Oct 12, 2010 IP
  4. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #4
    use concatinate..

    $url = 'domain.com';

    echo '<a href="''. $url .'">domain</a>';
     
    bartolay13, Oct 12, 2010 IP
  5. Prog4rammer

    Prog4rammer Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    NO No I Mean if the URL is :/show.php?category=php
    Convert
    to :/category/php
     
    Prog4rammer, Oct 12, 2010 IP
  6. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    oh... this is an htaccess matter, you should change htaccess to do that
    something like this:

    RewriteEngine On
    RewriteRule ^category/([a-zA-Z_0-9\-]+)$ show.php?category=$1
     
    max2010, Oct 12, 2010 IP