TinyPortal

Development => Support => Topic started by: Bardofyouth on May 02, 2010, 07:18:57 PM

Title: HTML Image Link in PHP
Post by: Bardofyouth on May 02, 2010, 07:18:57 PM
I have thoroughly used the search feature here on the forums and I've been wracking my brain on google, perhaps one of you coding legends could fix my code.  I am trying to use the php code to display members within flashchat in a block while also using html to display an image that members can click on to enter the chat room.  here is what I have:

echo "<img src='$home/chat.png'>";

global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';


That much works, it displays an image and uses the php as previously described.  However, when I add the a href part it blows up.  Such as:

echo "<a href="$home/chat/index.php"><img src='$home/chat.png'>";

global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';



What did I get wrong?  Thank you in advance for any and all help!
Title: Re: HTML Image Link in PHP
Post by: Bardofyouth on May 02, 2010, 07:22:46 PM
Ahh what a difference an apostrophe makes when used in the place of quotation marks.  I got it, I apologize for the post.

echo "<a href='$home/chat/flashchat.php'><img src='$home/chat.png'>";

global $boardurl;
echo '
<iframe frameborder="0" height="100" src="', $boardurl, '/chat/info_embedded.php" style="width: 100%; margin: 0; padding: 0; border: 0; overflow: hidden;" scrolling="no" border="0" allowtransparency="true"></iframe>';
Title: Re: HTML Image Link in PHP
Post by: JPDeni on May 02, 2010, 07:24:58 PM

echo "<a href=\"$home/chat/index.php\"><img src='$home/chat.png'>";


Or the way you did it. :)
Title: Re: HTML Image Link in PHP
Post by: ccbtimewizard on May 03, 2010, 12:55:45 AM
Better:

echo '<a href="' . $home . '/chat/index.php"><img src="' . $home . '/chat.png">';