Cool, I added new class to filters (h2o/filters.php):
class KohanaFilters extends FilterCollection {
static function anchor($link, $text, $attributes=null,
$protocol=null) {
return HTML::anchor($link, $text, $attributes, $protocol);
}
}
/* Add some Kohana filters */
h2o::addFilter(array('KohanaFilters'));
In template:
{{ '/controller/action' | anchor 'My action' }}
Well this works, however, I see two problems:
1) The helper HTML::anchor() returns string which includes HTML tags
and the tag boundaries '<' and '>' get escaped (htmlspecialchars?)
2) I need to pass an array of attributes to the 'anchor' filter - how?
{{ '/' | anchor 'Home', *array_of_attributes* }}
On 30 říj, 04:21, Taylor Luk <
subject...@gmail.com> wrote:
> You can register existing help into H2o as a filter by adding a callable
> type , see h2o/filters.php source code for detail
>
> Example:
>
> H2o::AddFilter('anchor', array('HTML', 'anchor'))
>
> {{ '/' | anchor 'home' }}
Luke, I've also tried what you suggested:
H2o::AddFilter('anchor', array('HTML', 'anchor'))
This escapes htmlspecialchars too. And I still need to pass an array
somehow.
Is there a solution? I really appreciate your help and patience! :-)
> > <
h2o-template-php%2Bunsu...@googlegroups.com<
h2o-template-php%252Buns...@googlegroups.com>