Welcome Guest, Not a member yet? Register   Sign In
My views are too complex, there is a way to avoid this?
#3

[eluser]OES[/eluser]
I agree with JHackmack BUT !.

Where I can I try not to use echo with a long block of code so what you could do is to use the other type of php if/foreach like this.

Code:
<?php if (condition): ?>
  // HTML  
<?php endif; ?>


<?php foreach ($variable as $key => $value): ?>
  // HTML    
<?php endforeach ?>


So with foreach for example with a table this looks alot better in the template.

Code:
<table width"100%" id="mytable">
<tr>
  <th>Title</th><th>Name</th>
</tr>
&lt;?php foreach ($variable as $key => $value): ?&gt;
  <tr>
    <td>&lt;?php echo $title; ?&gt;</td><td>&lt;?php echo $name; ?&gt;</td>
  </tr>    
&lt;?php endforeach ?&gt;
</table>

Another way would be to use Smarty as your template parser which looks even better again.

Hope this helps a little


Messages In This Thread
My views are too complex, there is a way to avoid this? - by El Forum - 01-17-2010, 01:54 PM
My views are too complex, there is a way to avoid this? - by El Forum - 01-17-2010, 02:48 PM
My views are too complex, there is a way to avoid this? - by El Forum - 01-17-2010, 04:06 PM
My views are too complex, there is a way to avoid this? - by El Forum - 01-17-2010, 04:19 PM
My views are too complex, there is a way to avoid this? - by El Forum - 01-18-2010, 06:06 AM
My views are too complex, there is a way to avoid this? - by El Forum - 01-18-2010, 11:10 AM
My views are too complex, there is a way to avoid this? - by El Forum - 01-18-2010, 11:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB