i have a problem counting array keys value in ezpublish whose php function is
array_count_values();
i need a similar function in ezpublish. Is there any operators in ezpublish or i have to make an extension for it too?
You can declare the php function as a new template operator for templates to use.
Add it to the template.ini override file.
If adding it to the template.ini of your site's extension does not work, just create an autoload. They are very simple to create and is how I often add any php function I need. You don't need a new extension for the autoload, just add it to your existing extension in the autoloads directory. Don't forget to declare your autoload in the eztemplateautoload.php file, you will likely have to add one of those to your autoloads directory too.
The count operator is what you are looking for here, it appears :
{def $arrayCount = $myArray|count()}
More on this operator in the documentation : http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Template-operators/Variable-and-type-handling/count
Generally, feel free to also drop your questions on the eZ Publish Community Portal : http://share.ez.no (but i think you already know this place ;) )
Hope it helps, Cheers,
If you need to use PHP native functions, you really should use this extension : http://projects.ez.no/wrap_operator
You just have to enable the selected function in the ini file of the extension and to use it in your templates.
For example :
{def $html = wrap_php_func('str_replace', array('&', '&', $article.data_map.descriptif.data_text))}
It will save your life !
As said by Nicolas, you can map any PHP functions to a template operator if :
Documentation : http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Configuration-files/template.ini/PHP/PHPOperatorList
So doing what you want is really easy since array_key_values() is a good candidate and matches the requirements.
After research for long time i found that, there is no any ez publish template operators for
array_count_values();
we have to make an extension for it. And process of making extension is given in the link below.http://blog.developeronhire.com/using-custom-php-functions-in-ez-publish-templates/
Thank you all