Help with simple HTML to PHP variables conversion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Blizna
Forum Newbie
Posts: 1
Joined: Sun Jan 25, 2009 5:43 pm

Help with simple HTML to PHP variables conversion

Post 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!
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Help with simple HTML to PHP variables conversion

Post 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;
?>
 
Post Reply