Page 1 of 1

Help with simple HTML to PHP variables conversion

Posted: Sun Jan 25, 2009 5:46 pm
by Blizna
Hello!

I have following HTML code with nested php parts:

<img src="galerie/1.jpg" width="<?echo(vratX('galerie/1.jpg'))?>" height="<?echo(vratY('galerie/1.jpg'))?>" onClick="okno('galerie/nahledy/1.jpg','<? echo(vratX('galerie/nahledy/1.jpg'))?>','<?echo(vratY('galerie/nahledy/1.jpg'))?>','Lerg','O.')" style="cursor:pointer">

I would really need to remake it to pure PHP when all this code would be in PHP part of page.
Im not familiar enough with that so I would be very grateful for help. Thank you!

Re: Help with simple HTML to PHP variables conversion

Posted: Sun Feb 01, 2009 3:24 am
by jaoudestudios
Blizna wrote:<img src="galerie/1.jpg" width="<?echo(vratX('galerie/1.jpg'))?>" height="<?echo(vratY('galerie/1.jpg'))?>" onClick="okno('galerie/nahledy/1.jpg','<? echo(vratX('galerie/nahledy/1.jpg'))?>','<?echo(vratY('galerie/nahledy/1.jpg'))?>','Lerg','O.')" style="cursor:pointer">

I would really need to remake it to pure PHP when all this code would be in PHP part of page.
NB: Dont use php short tags!

Ok this is a bit of a mess and I might have made a typo or two, but you get the idea. You could simply your code a lot, but i dont know the rest of the page. I definitely suggest simplifying the code.

Code: Select all

 
<?php
$page = "
  <img src='galerie/1.jpg' width='".vratX('galerie/1.jpg')."' height='".vratY('galerie/1.jpg')."' onClick='okno(\'galerie/nahledy/1.jpg\',\'".vratX('galerie/nahledy/1.jpg')."\'),\'".vratY('galerie/nahledy/1.jpg')."\',\'Lerg\',\'O.\'' style='cursor:pointer'>
";
echo $page;
?>