You are here:  » changing links

Support Forum



changing links

Submitted by rolli1 on Tue, 2010-10-26 15:07 in

Hi David,

I have some links to another site on my sites where I use PT.
These links have an sole text and a sole webaddress

e.g.
>a href="http://xxxxx.com"

is there any possibility to have different or changing link text and web address?
like:

>a href="http://xxxxx.com/blue.html"
>a href="http://xxxxx.com/black.html"

could this be done out of the database?

regards

Roland

Submitted by support on Tue, 2010-10-26 15:20

Hi Roland,

Do you mean you want to rotate the links and have a different one each time?

That can be done quite easily in PHP, with something like this:

<?php
  $links 
= array(
  
"http://www.example.com/blue.html"=>"Blue Text",
  
"http://www.example.com/red.html"=>"Red Text"
  
);
  
$link array_rand($links);
  print 
"<a href='".$link."'>".$links[$link]."</a>";
?>

Apologies if I have misunderstood...

Cheers,
David.
--
PriceTapestry.com

Submitted by rolli1 on Tue, 2010-10-26 15:30

Hi David,
this is that what I wanted....How many links can I put there and where have I to place that code? Into the /html/header.php
?
I also have a /html/header1.php for the comparison results. Can I also out the there?

Kind regards

Roland

Submitted by support on Tue, 2010-10-26 15:35

Hi Roland,

You can put as many links as you like in the array! Just remember not to put a comma after the last one!

The code can go anywhere you like in header or footer (or anywhere else for that matter), all you need to remember is that if you are in a PHP section already then you don't need the PHP tags, otherwise just paste it in exactly as it appears above...

Cheers,
David.
--
PriceTapestry.com

Submitted by rolli1 on Tue, 2010-10-26 15:59

Thanks very much and greetings....

Roland