About Push * ÀÌÀü    ´ÙÀ½    ¸ñ·Ï
·çÇÁ󸮸޼­µå´Â ¸Þ¼­µå À̸§¿¡ push °¡ ÀÖ´Â °Í°ú ¾ø´Â °ÍÀ¸·Î ±¸ºÐÇÒ ¼ö ÀÖÀ¸¸ç, push°¡ ÀÖ´Â ¸ðµç ¸Þ¼­µå´Â, ·çÇÁÀÇ ±¸°£(¼½¼Ç)À» ¹ß»ý½ÃŰ´Â ±â´ÉÀ» °øÅëÀ¸·Î ¼öÇàÇÕ´Ï´Ù. push ¸Þ¼­µåµéÀÇ ½ÇÇà ȸ¼ö¸¸Å­ ¼½¼ÇÀÌ ¹ß»ýÇÕ´Ï´Ù.
some.tpl >>output
{ @ someloop }
-- TEMPLATE SECTION --
<div>
{ someloop.variable }
</div>
{ / }
<div>
value 1
</div>
-- SECTION 1 --
<div>
value 2
</div>
-- SECTION 2 --
    ...
    ...
¾Æ·¡ÀÇ ¿¹Á¦´Â ½ÇÇàÆÄÀÏÀÇ ·çÇÁ°¡ 3ȸ µ¹Áö¸¸ ¼½¼ÇÀÌ ¹ß»ýÇÏÁö ¾Ê¾Æ Ãâ·ÂµÇÁö ¾ÊÀº °æ¿ìÀÔ´Ï´Ù.
index.php
...
$fruit=array(1=>'apple','orange','melon');
$tpl->loopLoad('fruit');
foreach ($fruit as $num => $name) {
    $tpl->loopAssign(array(
        'num'  =>$num,
    ));
    $tpl->loopAssign(array(
        'name' =>$name,
    ));
}
...
index.tpl
<table>
{@ fruit}
<tr><td>{ .num }</td><td>{ .name }</td></tr>
{/}

</table>
>>output
<table>
</table>
¾Æ·¡ÀÇ ¿¹Á¦´Â push¸Þ¼­µåÀÇ Áߺ¹»ç¿ëÀ¸·Î ¼½¼ÇÀÌ 6°³ ¸¸µé¾îÁø °æ¿ìÀÔ´Ï´Ù.
index.php
...
$fruit=array(1=>'apple','orange','melon');
$tpl->loopLoad('fruit');
foreach ($fruit as $num => $name) {
    $tpl->loopPushAssign(array(
        'num'  =>$num,
    ));
    $tpl->loopPushAssign(array(
        'name' =>$name,
    ));
}
...
>>output
<table>
<tr><td>1</td><td></td></tr>
<tr><td></td><td>apple</td></tr>
<tr><td>2</td><td></td></tr>
<tr><td></td><td>orange</td></tr>
<tr><td>3</td><td></td></tr>
<tr><td></td><td>melon</td></tr>

</table>
½ÇÇàÆÄÀÏÀÇ ·çÇÁ¿¡¼­, ù ·çÇÁ¸Þ¼­µå¿¡¸¸ push¸¦ ³ÖÀ¸¸é ¿øÇÏ´Â Ãâ·ÂÀ» ¾òÀ» ¼ö ÀÖ½À´Ï´Ù.
index.php
...
$fruit=array(1=>'apple','orange','melon');
$tpl->loopLoad('fruit');
foreach ($fruit as $num => $name) {
    $tpl->loopPushAssign(array(
        'num'  =>$num,
    ));
    $tpl->loopAssign(array(
        'name' =>$name,
    ));
}
...
>>output
<table>
<tr><td>1</td><td>apple</td></tr>
<tr><td>2</td><td>orange</td></tr>
<tr><td>3</td><td>melon</td></tr>

</table>
½ÇÁ¦ÀÛ¾÷ÇÒ ¶§´Â loopPushAssign() ¸Þ¼­µå¸¦ ÇÑ ¹ø¸¸ »ç¿ëÇϰí Çʿ信 µû¶ó ¿¹¾àº¯¼ö¸¦ Ȱ¿ëÇϸé, ´ëºÎºÐÀÇ ·çÇÁº¯¼öÇÒ´çÀ» ó¸®ÇÒ ¼ö ÀÖÀ» °ÍÀÔ´Ï´Ù.
´ÙÀ½Àº ·çÇÁ¸Þ¼­µå¸¦ ¹Ù¸£°Ô »ç¿ëÇÑ ¿¹Á¦µéÀÔ´Ï´Ù. pushÀÇ À§Ä¡¸¦ È®ÀÎÇØ º¸½Ã±â ¹Ù¶ø´Ï´Ù.
index1.php
...
$tpl->loopLoad('abc');
while (...) {
    $tpl->loopPushAssign(array(;
        ...
    ));
    ...
    $tpl->loopAssign(array(
        ...
        ...
    ));
}
...
index2.php
...
$tpl->loopLoad('abc', 1);
while (...) {
    $tpl->loopPushLoad('xyz', 2);
    while (...) {
        $tpl->loopPushAssign(array(
            ...
        ), 2);
    }
    $tpl->loopAssign(array(
        ...
        ...
    ), 1);
}
...
index3.php
...
$tpl->loopLoad('aaa', 1);
while (...) {
    $tpl->loopPushAssign(array(;
        ...
        ...
    ));
    $tpl->loopLoad('bbb', 2);
    while (...) {
        $tpl->loopPushLoad('ccc', 3);
        while (...) {
            $tpl->loopPushAssign(array(
                ...
                ...
            ), 3);
        }
        $tpl->loopAssign(array(
            ...
        ), 2);
    }
    $tpl->loopAssign(array(
        ...
        ...
    ), 1);
}
...
index4.php
...
$tpl->loopLoad('aaa', 1);
while (...) {
    $tpl->loopPushLoad('xxx', 2);
    while (...) {
        $tpl->loopPushAssign(array(
            ...
            ...
        ), 2);
    }
    $tpl->loopLoad('yyy', 2);
    while (...) {
        $tpl->loopPushAssign(array(
            ...
            ...
        ), 2);
    }
    $tpl->loopLoad('zzz', 2);
    while (...) {
        $tpl->loopPushAssign(array(
            ...
            ...
        ), 2);
    }
}
...
 ÀÌÀü ¸ñ·Ï ´ÙÀ½ 
 
2003-03-03 ~