phpsource/템플릿2008. 7. 16. 01:11
written: Jul 16 2008
반복되는 블록요소
Case #1
[code html;gutter:false] <table border="1"> <tr> <th bgcolor="#000066" style="color:white;">classify</th> <th bgcolor="#0000ff" style="color:white;">column1</th> <th bgcolor="#0000ff" style="color:white;">column2</th> <th bgcolor="#0000ff" style="color:white;">column3</th> </tr> <tempo id="eLoop"> <tr bgcolor="silver" style="height:30;"> <td align="center" bgcolor="#000066" style="color:white;"> <?=$column0?> </td> <td align="center"><?=$column1?></td> <td align="center"><?=$column2?></td> <td align="center"><?=$column3?></td> </tr> </tempo> </table> [/code]
< Template file : tempo.sample.htm >
[code php;gutter:false] <?php $columns[0]['column0'] = 'Country'; $columns[0]['column1'] = 'Korea'; $columns[0]['column2'] = 'USA'; $columns[0]['column3'] = 'Germany'; $columns[1]['column0'] = 'Capital city'; $columns[1]['column1'] = 'Seoul'; $columns[1]['column2'] = 'Washington DC'; $columns[1]['column3'] = 'Berlin'; $columns[2]['column0'] = 'Population'; $columns[2]['column1'] = '49,000,000'; $columns[2]['column2'] = '301,000,000'; $columns[2]['column3'] = '82,000,000'; include_once('class.Tempo2.php'); $tempo = &new Tempo2; $tempo->parse('sample', 'tempo.sample.htm'); $tempo->el['eLoop']->assign(''); foreach ($columns as $column) { extract($column); $tempo->el['eLoop']->assign('.'); } $tempo->el['sample']->assign(); $tempo->el['sample']->output(); ?> [/code]
< PHP coding >
< Result >

'phpsource > 템플릿' 카테고리의 다른 글

{템포2}6.다운로드  (0) 2008.07.16
{템포2}4.멤버함수  (0) 2008.07.16
{템포2}3.템플릿 문서  (0) 2008.07.16
{템포2}2.기초다지기  (0) 2008.07.16
{템포2}1.소개  (0) 2008.07.16
Posted by 방글24