2010年11月18日星期四

Re: [fw-mvc] How to clear view placeholders? (headTitle, headLink, headScript, inlineScript...)

Placeholder-type view helpers extend ArrayObject, so you can do this:

$view->headTitle()->exchangeArray(array());

--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com

On Tue, Nov 16, 2010 at 6:48 AM, Rafael Hengles <rhengles@gmail.com> wrote:

> Right now i'm doing this:
>
> <?php
> $phEmpty = array('headTitle', 'headLink', 'headScript', 'inlineScript');
> foreach ( $phEmpty as $phn ) {
> $ph = $view->$phn();
> $phikeys = array();
> foreach ( $ph as $phik => $phiv ) array_push($phikeys, $phik);
> foreach ( $phikeys as $phik ) unset( $ph[$phik] );
> }
> ?>
>
> Is there a better way?
>
> Thanks
>
>

没有评论: