24/06/19 19:16:23.02 uJR8IweHP
<?php
require_once 'smarty/libs/Smarty.class.php';
$smarty = new Smarty();
$smarty->template_dir = 'templates/';$smarty->compile_dir = 'templates_c/';
$sharks = array(1=>"Baby",2=>"Mommy",3=>"Daddy",4=>"Grandma",5=>"Grandpa");$doo = "";
for($i = 1; $i < 6; $i++) {for($j = 0; $j < 3; $j++) {$doo = $doo.$sharks[$i]. " "; ;
for($k = 0; $k < 6; $k++) {$doo = $doo."doo ";}$doo = $doo."\n";}
$doo = $doo.$sharks[$i] . "\n";}$smarty->assign('title', 'sharks');
$smarty->assign('shark1', $doo);$smarty->assign('shark2', $sharks);
$smarty->display('test.html');
?>
<html lang='ja'>
<head><meta http-equiv='content-type' content='text/html; charset=UTF-8'>
<title>{$title|escape}</title></head>
<body text='black' bgcolor='white'>
<div align='center'><h2>KIDS SONG</h2>
<table border="1"><tr><td>{foreach from=$shark1 item=item2}
{$item2}{/foreach}{math equation="rand(1,5)" assign="result"}{$result}
{if $result==1}{$shark2[1]}{elseif $result==2}{$shark2[2]}
{elseif $result==3}{$shark2[3]}{elseif $result==4}{$shark2[4]}
{else}{$shark2[5]}{/if}</td>
</tr></table></div></body></html>