phpsource/템플릿2007. 9. 1. 17:45
written: Sep 1 2007
Repeat a block
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> <tr tempo:id="eLoop" bgcolor="silver" style="height:30;"> <td align="center" bgcolor="#000066" style="color:white;"> {?=$eLoop->column0?} </td> <td align="center">{?=$eLoop->column1?}</td> <td align="center">{?=$eLoop->column2?}</td> <td align="center">{?=$eLoop->column3?}</td> </tr> </table> [/code]
< Template file : tempo.sample.htm >
[code php;gutter:false] <?php $column[0]['column0'] = 'Country'; $column[0]['column1'] = 'Korea'; $column[0]['column2'] = 'USA'; $column[0]['column3'] = 'Germany'; $column[1]['column0'] = 'Capital city'; $column[1]['column1'] = 'Seoul'; $column[1]['column2'] = 'Washington DC'; $column[1]['column3'] = 'Berlin'; $column[2]['column0'] = 'Population'; $column[2]['column1'] = '49,000,000'; $column[2]['column2'] = '301,000,000'; $column[2]['column3'] = '82,000,000'; require_once('class.Tempo.php'); $tempo = new Tempo; $tempo->parse('eRoot', 'tempo.sample.htm'); $eLoop->outerHTML = $eLoop->assign($column); print $eRoot->assign(); $tempo->clear('eRoot'); ?> [/code]
< PHP coding >
< Result >
Case #2
[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> <tr tempo:id="eLoop" bgcolor="silver" style="height:30;"> <td align="center" bgcolor="#000066" style="color:white;"> {?=$this->column0?} </td> <td align="center">{?=$this->column1?}</td> <td align="center">{?=$this->column2?}</td> <td align="center">{?=$this->column3?}</td> </tr> </table> [/code]
< Template file : tempo.sample.htm >
[code php;gutter:false] <?php $column[0]['eLoop'][0]['column0'] = 'Country'; $column[0]['eLoop'][0]['column1'] = 'Korea'; $column[0]['eLoop'][0]['column2'] = 'USA'; $column[0]['eLoop'][0]['column3'] = 'Germany'; $column[0]['eLoop'][1]['column0'] = 'Capital city'; $column[0]['eLoop'][1]['column1'] = 'Seoul'; $column[0]['eLoop'][1]['column2'] = 'Washington DC'; $column[0]['eLoop'][1]['column3'] = 'Berlin'; $column[0]['eLoop'][2]['column0'] = 'Population'; $column[0]['eLoop'][2]['column1'] = '49,000,000'; $column[0]['eLoop'][2]['column2'] = '301,000,000'; $column[0]['eLoop'][2]['column3'] = '82,000,000'; require_once('class.Tempo.php'); $tempo = new Tempo; $tempo->parse('eRoot', 'tempo.sample.htm'); print $eRoot->assign($column); $tempo->clear('eRoot'); ?> [/code]
< PHP coding >
< Result >
Group a block
[code html;gutter:false] <table border="1"> <tr> <th width="120" bgcolor="#000066" style="color:white;">classify</th> <th width="120" bgcolor="#0000ff" style="color:white;">column1</th> <th width="120" bgcolor="#0000ff" style="color:white;">column2</th> <th width="120" bgcolor="#0000ff" style="color:white;">column3</th> </tr> <tr tempo:id="eLoop" bgcolor="silver" style="height:30;"> <td align="center" bgcolor="#000066" style="color:white;"> {?=$this->column0?} </td> <td align="center">{?=$this->column1?}</td> <td align="center">{?=$this->column2?}</td> <td align="center">{?=$this->column3?}</td> </tr> </table> [/code]
< Template file : tempo.sample.htm >
[code php;gutter:false] <?php $column[0]['eLoop'][0]['column0'] = 'Country'; $column[0]['eLoop'][0]['column1'] = 'Korea'; $column[0]['eLoop'][0]['column2'] = 'USA'; $column[0]['eLoop'][0]['column3'] = 'Germany'; $column[0]['eLoop'][1]['column0'] = 'Capital city'; $column[0]['eLoop'][1]['column1'] = 'Seoul'; $column[0]['eLoop'][1]['column2'] = 'Washington DC'; $column[0]['eLoop'][1]['column3'] = 'Berlin'; $column[0]['eLoop'][2]['column0'] = 'Population'; $column[0]['eLoop'][2]['column1'] = '49,000,000'; $column[0]['eLoop'][2]['column2'] = '301,000,000'; $column[0]['eLoop'][2]['column3'] = '82,000,000'; $column[1]['eLoop'][0]['column0'] = 'Country'; $column[1]['eLoop'][0]['column1'] = 'Brazil'; $column[1]['eLoop'][0]['column2'] = 'Italy'; $column[1]['eLoop'][0]['column3'] = 'Thailand'; $column[1]['eLoop'][1]['column0'] = 'Capital city'; $column[1]['eLoop'][1]['column1'] = 'Brasilia'; $column[1]['eLoop'][1]['column2'] = 'Roma'; $column[1]['eLoop'][1]['column3'] = 'Bangkok'; $column[1]['eLoop'][2]['column0'] = 'Population'; $column[1]['eLoop'][2]['column1'] = '170,000,000'; $column[1]['eLoop'][2]['column2'] = '58,000,000'; $column[1]['eLoop'][2]['column3'] = '58,000,000'; require_once('class.Tempo.php'); $tempo = new Tempo; $tempo->parse('eRoot', 'tempo.sample.htm'); print $eRoot->assign($column); $tempo->clear('eRoot'); ?> [/code]
< PHP coding >
< Result >

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

{후키템플릿}8.1.필터 기능  (0) 2008.05.31
{Tempo}6.Download  (0) 2007.09.01
{Tempo}4.Class Methods  (0) 2007.09.01
{Tempo}3.Template contents  (0) 2007.09.01
{Tempo}2.Step by step  (0) 2007.09.01
Posted by 방글24