Jump to content

Archived

This topic is now archived and is closed to further replies.

0207100

Making This URL Work with Vars -

Recommended Posts


I need to take this array and have it print.

function print_link_item($item) {
echo '<p>';
echo $item['Heading']."<br />\n";
echo $item['URI']."<br />\n";
echo $item['Description']."<br />\n";
echo $item['URL'];
echo '</p>';


I want to have the Heading display the Link and when the user mouse overs the link instead of seeing the URI (real url) they will see the [URL] i want them to see.

How do I make the following work, I have fiddled with it and just cant make it work.

<a href="[URI]" target = '_blank' onMouseOver="window.status='[URL]'; return true;" onMouseOut="window.status=''; return true;">[Heading]</a>

Thanks

Share this post


Link to post
Share on other sites
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"'_blank" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>

echo '</p>';
}

Share this post


Link to post
Share on other sites
[!--quoteo(post=352807:date=Mar 8 2006, 07:08 AM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Mar 8 2006, 07:08 AM) [snapback]352807[/snapback][/div][div class=\'quotemain\'][!--quotec--]
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"'_blank" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>

echo '</p>';
}
[/quote]


Thanks for the help, I tried your code but have got the following error:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Im new to php and havent got a lot of experience.

Share this post


Link to post
Share on other sites
You missed a "slash"... This should do it...
[code]
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"_blank\" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>
echo '</p>';
}
[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=352824:date=Mar 8 2006, 07:38 AM:name=AV1611)--][div class=\'quotetop\']QUOTE(AV1611 @ Mar 8 2006, 07:38 AM) [snapback]352824[/snapback][/div][div class=\'quotemain\'][!--quotec--]
You missed a "slash"... This should do it...
[code]
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"_blank\" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>
echo '</p>';
}
[/code]
[/quote]


Hummm still not working and getting the parse error.

I even tried this:
[code]
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"_blank\" onMouseOver=\"window.status='$item['URL']'; return true;\"onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>";
echo '</p>';
}
[/code]
and it also returned the parse error.

A stupid qustion on my behalf - in the original snip the var had a "." after it
[code]
function print_link_item($item) {
        echo '<p>';
        echo $item['Heading']."<br />\n";
        echo $item['URI']."<br />\n";
        echo $item['Description']."<br />\n";
        echo $item['URL'];
        echo '</p>';
}
[/code]

Why is a . not used in this example?

[code]
function print_link_item($item) {
echo '<p>';
echo "<a href=\"$item['URI']\" target =\"_blank\" onMouseOver=\"window.status='$item['URL']'; return true;\" onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>
echo '</p>';
}
[/code]

Share this post


Link to post
Share on other sites
In the first case, the $item is aready included in the echo " "

echo "<a href=\"$item['URI']\" target =\"_blank\" onMouseOver=\"window.status='$item['URL']'; return true;\"onMouseOut=\"window.status=''; return true;\">$item['Heading']</a>";

In the second case, $item is not required to be in "" but it must be concenated to the portion that does require the ""'s

echo $item['Description']."<br />\n";

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.