Forums / Developer / Transform array to template function parameters ?
H-Works Agency
Friday 06 January 2006 7:48:49 am
How can i simply pass an array to a template function as if those 'key/values' pairs where the template function's parameters ? With a custom operator (something like 'list()') ?
Example :
{def $array=hash('view', 'line', 'name', 'sven'} {node_view_gui node=$node $array|list} The 'list' operator would transform '$array' to this : {node_view_gui node=$node $view='line' $name='sven'}
Is it possible ? How can i achieve this ?
Being able to do this would be a great help for me so thanx in advance...
Martin
EZP is Great
Nabil Alimi
Monday 09 January 2006 5:29:31 am
Hi Martin,
That seems a bit complicated. I dont know if what you describe is possible. But could you for example have 2 variables ? One for the view that will be a string and one other that will be an array that you'll pass to your template. Something like this.
{node_view_gui view=$myView myVarArray=$myArray}
My blog : http://www.starnab.com/ezpublish / http://www.starnab.com/ / http://www.assiki-consulting.com eZ Publish Freelance developper. Feel free to contact me +33 674 367 057 nabil at assiki d0t fr