WebsiteBaker Support (2.8.x) > Templates, Menus & Design
Edit Index.php [Template] Help
aldus:
Hello
Instead of a mess of "if-then elseif" combinations i would prefer to make it direct, e.g.
--- Code: ---<?php
/**
* @version 0.2.0
* @date 2008-08-20
* @author
* @package WebsiteBaker - Code examples
* @state @dev
*
* Getting a random image for the header;
* in the form "img_0<1|2|3>.jpg"
*
*/
echo "<img src='images/header/img_0".rand(1,3).".jpg'>";
?>
--- End code ---
And instead of calling an external file inside the template three times
you can keep it small and simple like this one:
--- Code: ---<center>
<table border="0" cellpadding="0" cellspacing="0" width="75%">
<tr>
<td width="33%" align="center"><? echo "<img src='images/header/img_0".rand(1,3).".jpg'>"; ?></td>
<td width="34%" align="center"><? echo "<img src='images/header/img_0".rand(1,3).".jpg'>"; ?></td>
<td width="33%" align="center"><? echo "<img src='images/header/img_0".rand(1,3).".jpg'>"; ?></td>
</tr>
</table>
</center>
--- End code ---
Regards
Aldus
Navigation
[0] Message Index
[*] Previous page
Go to full version