I have the following PHP code for one of my blocks
<?php global $base_url; ?>
<div class = "order-help">
<div class = "rc-img"><img src = "<?php print $base_url; ?>/sites/all/themes/businessconnect/images/contacts-box.jpg" alt = ""/></div>
</div>
This displays the image fine in my block but i also want to make the image a hyperlink to some other page. For that i used the following code
<?php global $base_url; ?>
<div class = "order-help">
<?php print( <a href="http://mylink.com/path/">
<div class = "rc-img">
<img src = "<?php print $base_url; ?>/sites/all/themes/businessconnect/images/contacts-box.jpg" alt = ""/></div>
</a>' ); ?>
</div>
But it does not work. What am i missing?
Please Help
Just add an
<a>tag to the HTML.Your code wasn’t working because
printneeds you to pass it a string, and you also had<?php print $base_url ?>inside of a<?phpblock.