...

View Full Version : links not active



tau9
03-23-2009, 12:01 PM
Hi,

I can get links from txt document but the links aren't active i.e. can't click on them there just text. Any ideas of how to get them active:
<?php
=====================
echo '<ul>';
foreach ($elements as $kw){
echo '<li>' .htmlentities($kw->nodeValue).
'('.htmlentities($kw->getAttribute('href')).')</li>';
}
echo '</ul>';
?>
thanks is advance

tomws
03-23-2009, 02:18 PM
Basic HTML: wrap them in an anchor tag (http://www.w3schools.com/TAGS/tag_a.asp).

tau9
03-23-2009, 02:50 PM
thanks for the reply

I have tried adding <a> </a> tags but doesn't seem to work.

tomws
03-23-2009, 03:59 PM
What does the actual html look like after you do that?

TheShaner
03-23-2009, 04:34 PM
Without knowing how your $elements object array is set up, I'm guessing that $kw->getAttribute('href') returns the link you want to click on. Based on that assumption, try the below. This is what tomws wants you to do:

foreach ($elements as $kw){
echo '<li>' .htmlentities($kw->nodeValue).
'(<a href="'.htmlentities($kw->getAttribute('href')).'">'.htmlentities($kw->getAttribute('href')).'</a>)</li>';
}
echo '</ul>';
The above is printing the link with it wrapped in anchor tags. What you also need is the HREF in the anchor tag to be set to the link. So you must print the link twice: once for the HREF and once to display the link to the screen to be clicked on.

-Shane

webh4x0r
03-23-2009, 04:36 PM
thanks for the reply

I have tried adding <a> </a> tags but doesn't seem to work.

Adding only <a> </a> never works.

<a href="XXX"></a> will works.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum