Jump to content

templates rather than echo?


forcer

Recommended Posts

may or may not help, but you know you can mix php and html right?

 

This is valid code:

 

<?php
$test = 1;
$test2 = 2;
$test3 = array("one" => 1, "two"=> 2, "three"=> 3);
?>

<table>
  <tr>
     <td><?=$test?></td>
     <td><?=$test2?></td>
  </tr>
<?
  foreach($test3 as $key => $value){ ?>
  <tr>
     <td><?=$key?></td>
     <td><?=$value?></td>
  </tr>

<? }?>
</table>

 

Not a single echo statement and my html is basically how it would be without the php at all. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.