-- Bagus Nugroho <[email protected]> wrote
(on Wednesday, 17 December 2008, 10:31 PM +0700):
> Hi All,
>  
> If I have view script like this
> xxxx.phtml
> -------------------
> // other xxxx code
>  
> // --- code that will be used on several view scripts
>    <? if(!empty($this->data)): ?>   
>     <? foreach($this->data as $v):?>
>      <div class="span-17 list-project">
>       <span class="pr-title"><?= $v->title ?></span><br />
>       <span class="pr-by">Proposed By <?= ucwords($v->cby) ?></span><br />
>       <span class="pr-time">Time : <?= $v->cbo ?></span>
>       <div class="span-9 pr-desc"><?= $v->description ?></div>
>       <div class="span-9 pr-desc"><?= $v->target ?></div>
>      </div>
>     <? endforeach ?>   
>    <? endif ?>
> // ---- end
>  
> //other xxxx code
>  
> and,
> yyyy.phtml
> -------------------
> // other yyyy code
>  
> // --- code that will be used on several view scripts
>    <? if(!empty($this->data)): ?>   
>     <? foreach($this->data as $v):?>
>      <div class="span-17 list-project">
>       <span class="pr-title"><?= $v->title ?></span><br />
>       <span class="pr-by">Proposed By <?= ucwords($v->cby) ?></span><br />
>       <span class="pr-time">Time : <?= $v->cbo ?></span>
>       <div class="span-9 pr-desc"><?= $v->description ?></div>
>       <div class="span-9 pr-desc"><?= $v->target ?></div>
>      </div>
>     <? endforeach ?>   
>    <? endif ?>
> // ---- end
>  
> //other yyyy code
>  
> ====================
> Is possible to set three step view to avoid doing the same thing?
> Or we can utilize View Helpers to solve it?

View helpers and partial scripts are your friends here. :)

-- 
Matthew Weier O'Phinney
Software Architect       | [email protected]
Zend Framework           | http://framework.zend.com/

Reply via email to