Array.php

<? include_once("libs/smarty.class.php"); $smarty = new smarty(); $students = array( "didar" => array("name"=>"Didar Bhuiyan","roll"=>12), "emran" => array("name"=>"Emran Hasan","roll"=>18), "hasan" => array("name"=>"Tanveer Hasan","roll"=>23)); $smarty->assign("students",$students); $smarty->display("associative_array.tpl"); ?> <html> <body> <table> <tr><td>Name</td><td>Roll</td></tr> {foreach item=student from=$students} <tr> <td>{$student.name}</td> <td>{$student.roll}</td> </tr> {/foreach} </table> </body> </html>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.