Skip to content
WJunction - Webmaster Forum

PHP Function (Link_Maker)

Status
Not open for further replies.
hey this is just a simple bit of code that i just made for another project and thought it might be usfull to ppl so here it is....

Code:
function make_link($url,$name,$class){
    $link = '<a href="'.$url.'"';
    if($class){
        $link .= ' class="'.$class.'"';
    }
    $link .= $name ? '>'.$name.'</a>' : '>'.$url.'</a>';
    echo $link;
}

there are 4 modes to create links...

1.
Code:
make_link('http://www.litewarez.com','','');
(>> <a href="http://www.litewarez.com">http://www.litewarez.com</a>

2.
Code:
make_link('http://www.litewarez.com','LiteWarez Home','');
(>> <a href="http://www.litewarez.com">Litewarez Home</a>

3.
Code:
make_link('http://www.litewarez.com','LiteWarez Home','this_is_css_class');
(>> <a href="http://www.litewarez.com" class="this_is_css_class">Litewarez Home</a>

4.
Code:
make_link('http://www.litewarez.com','','this_is_css_class');
(>> <a href="http://www.litewarez.com" class="this_is_css_class">http://www.litewarez.com</a>

as you can see this small snippep has good functionality and as long as you have an url you can create a link..

also its greate for your templates if you use this throughout your scripts..

peace.
 
Status
Not open for further replies.

About the author

L
Active Member · Joined
I am a skilled programmer within PHP,HTML,CSS,MYSQL and also the owner of several websites Programming, Football...
1,367
Messages
1
Reactions
38
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom