Forums / Setup & design / [Solved] content/keyword and empty view_parameters
Jeremy B.
Thursday 20 August 2009 1:32:52 am
Hi all,
Has anyone managed to work with $view_parameters in a content/keyword template ?
In an overrided template, it works like a charm, but not in a "content/keyword". The parameters are just not there, but the url has its parameters.
Any ideas ?
Thanks in advance :)
André R.
Thursday 20 August 2009 2:26:31 am
Its not supported by the keyword view, a quick glance in the 20 lines of code in kernel/content/keyword.php shows that it supports 'Alphabet', 'Offset' and 'ClassID'. in kernel/content/module.php the last two are defined as unordered params meaning the syntax is like:content/keyword/SomeKeyword/(offset)/0/(classid)/2
These parameters are available in the template, and I'll let you figgure out where from the view code(simplified):
$tpl->setVariable( 'view_parameters', array( 'offset' => $Offset, 'classid' => $ClassID )); $tpl->setVariable( 'alphabet', $Alphabet );
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom
Thursday 20 August 2009 2:55:46 am
Thanks André for your quick reply :)
I didn't think about checking the php file.
I'm going to do an override of the keyword.php and module.php files in order to set the params I need to the template.
Thank !
Thursday 20 August 2009 3:45:26 am
Hi again...
I folowed this article :http://ezpedia.org/en/solution/overriding_kernel_classes_within_an_extension
in order to override the keyword.php file.
Then I get the message "var/autoload/ezp_override.php not found". I don't understand what to put in this file...
Am I on the right way ?
Any help would be very appreciated :)
Thursday 20 August 2009 4:15:10 am
Neither module.php or view files like keyword.php are classes, so you can't override them like that. You can however copy it to your own module instead (you'll need to create one in a extension) and have your very own custom keyword view there.Optionally you can in addition use url alias to redirect urls from content/keyword to mymodule/keyword, but only if you don't want to correct the url in the templates.
Thursday 20 August 2009 5:53:30 am
Ok I get it now.
Thanks for your help :)