Page 1 of 1

how do i replace this html code with php?

Posted: Tue Nov 23, 2010 1:21 pm
by dsanche
Hi,

I am trying to convert my html code to a php script. For example my html: <img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0">

becomes <?php print getOffer(1, '<img src="images/tryitfree.jpg" alt="my image" />'); ?>

This works well enough except that my html code is more complex as the image changes when it is moused over. So the html actually looks like this:

<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>


My question is how to code this in php? How do I include this mouseover image while still coding it in PHP as above.

Any help or suggestions is greatly appreciated.

Thanks
Dsanche

Re: how do i replace this html code with php?

Posted: Tue Nov 23, 2010 1:55 pm
by Neilos
To write;

Code: Select all

<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
In php I would;

Code: Select all

<?php
//some php code
echo "<a href=\"#\" onMouseOut=\"MM_swapImgRestore()\" onMouseOver=\"MM_swapImage('Image68',\'','images/index-html-final_28.jpg',1)\"><img src=\"images/tryitfree.jpg\" name=\"Image68\" width=\"290\" height=\"66\" border=\"0\"></a>";
//some more php code
?>
Or;

Code: Select all

<?php
//some php code
?>
<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>
<?php
//some more php code
?>
Is this what you want?

Re: how do i replace this html code with php?

Posted: Tue Nov 23, 2010 2:10 pm
by dsanche
Thanks for the response.

I am basically trying to integrate this html code : <a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image68','','images/index-html-final_28.jpg',1)"><img src="images/tryitfree.jpg" name="Image68" width="290" height="66" border="0"></a>


into this code:

<?php print getOffer(1, '<img src="images.jpg" alt="my image" />'); ?>


it would be easy if i was just using a simple image. In PHP it would look like: <?php print getOffer(1, '<img src="images/tryitfree.jpg" alt="my image" />'); ?>
But how do i do this so that the mouse over code is included as well?

I hope thats more clear

dsanche