Reputation:
How would I make this work in PHP:
$string = "<div id="widget14" class="widget widget-124">
<a href="http://website.com/page.php?id={$pageurl}"><p><span class="hotspot" onmouseover="tooltip.show('<strong>About Us</strong><br/>Learn about us!');" onmouseout="tooltip.hide();"><img class="images_button" alt="About Image" src="{$image_url}" width="172px"/><br/>About Us</span></p></a>
</div>";
Upvotes: 0
Views: 75
Reputation: 791
$string = "<div id=\"widget14\" class=\"widget widget-124\">
<a href=\"http://website.com/cgames/\"><p><span class=\"hotspot\" onmouseover=\"tooltip.show('<strong>About Us</strong><br/>Learn about us!');\" onmouseout=\"tooltip.hide();\"><img class=\"images_button\" alt=\"About Image\" src=\"http://www.website.com/images/logo.png\" width=\"172px\"/><br/>About Us</span></p></a>
</div>\";
Above should work prerfectly fine.
Upvotes: 0
Reputation: 32155
No PHP required:
<div id="widget14" class="widget widget-124">
<a href="http://website.com/cgames/"><p><span class="hotspot" onmouseover="tooltip.show('<strong>About Us</strong><br/>Learn about us!');" onmouseout="tooltip.hide();"><img class="images_button" alt="About Image" src="http://www.website.com/images/logo.png" width="172px"/><br/>About Us</span></p></a>
</div>
If it absolutely must be a variable:
$string = <<<HTML
<div id="widget14" class="widget widget-124">
<a href="http://website.com/cgames/"><p><span class="hotspot" onmouseover="tooltip.show('<strong>About Us</strong><br/>Learn about us!');" onmouseout="tooltip.hide();"><img class="images_button" alt="About Image" src="http://www.website.com/images/logo.png" width="172px"/><br/>About Us</span></p></a>
</div>
HTML;
Otherwise you're stucking escaping quotes with back-slashes.
Upvotes: 4