You are here: Re: [SMARTY] Unregistering output filter method (and solution) « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Unregistering output filter method (and solution)

Posted by "messju mohr" on 10/26/05 09:48

On Wed, Oct 26, 2005 at 02:05:12AM +0100, Marcus Bointon wrote:
> One for the archives.
>
> I register an output filter using a method within a smarty subclass
> like this:
>
> $this->register_outputfilter(array($this, 'myoutputfilter'));
>
> Now I wantHow should I unregister a filter that's declared that way
> from outside the instance? I initially tried:
>
> $smarty->unregister_outputfilter(array($smarty, 'myoutputfilter'));

$smarty->unregister_outputfilter('myoutputfilter');

and no, you can't register two different outputfilters with the same
method name (the latter will override the former). and yes, this is a
limitation.

> (where $smarty is the same instance as $this) but that doesn't work
> (it keeps on filtering).
>
> I noticed that the object reference syntax is not shown in the docs
> for unregister_outputfilter(), so I though I'd just give it a try
> without the object reference syntax within a new method, and it works!
>
> public function disablefilter() {
> $this->unregister_outputfilter('myoutputfilter');
> }
>
> It would be nice to have this mentioned on the docs for
> unregister_outputfilter.
>
> I guess that this may potentially have implications if you also have
> global output filters with the same names that you don't want to
> unregister, but then if you code like that you deserve it!
>
> Incidentally I think that the bug that was killing my template output
> was in this output filter method, as I'm now getting expected output.
>
> Marcus
> --
> Marcus Bointon
> marcus@bointon.com | http://www.bointon.com/
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация