How to locate the PHP code corresponding to a template operator?

I've seen this question for the datetime operator lately on Google+. This is a very common question that has an easy answer whenever you know how the eZ Publish template operators are working internally.

If you look at the tutorial on how to write a template operator in an eZ Publish extension, you'll notice that you have to declare in an array that a given set of template operators is implemented by a given PHP class. This system is valid for extensions but in fact, it's also how the stock template operators are declared. The only difference is where the eztemplateautoload.php files are located. For the stock template operators, those files are in the directories listed in site.ini/[TemplateSettings]/AutoloadPathList[] and not in the autoloads sub-directory of each extension declared in site.ini/[TemplateSettings]/ExtensionAutoloadPath[].

Given that, it's easy to find where the datetime operator is declared for instance with the following command:

$ find . -name eztemplateautoload.php -exec grep -il datetime {} \;
# looking for file named eztemplateautoload.php containing "datetime"
./lib/eztemplate/classes/eztemplateautoload.php

And by looking at this file, you can see that this template operator is implemented by the class eZTemplateLocaleOperator and the autoload file or your favorite IDE will then show you where it is located in the eZ Publish directory.

» Commentaires

- bonne idee (#69670) par gggeek le 14 octobre 2011 à 23:57
Mais je faire mieux. je vais mettre ca dans ggsysinfo!

;-)

volontaires bienvenus
- Utile (#69671) par Nicolas le 15 octobre 2011 à 12:54
Bien utile.
Avoir ça dans un outil system-agnostic serait top.
Merci Damien !

Flux RSS des billets

Flux RSS des billets

Rechercher sur pwet.fr

À retenir

Derniers commentaires

Archives

Nuage de tags

Bioutifoul photos

Quelques liens

Licence d'utilisation

Contenu sous Licence Creative Commons By-Sa

Sauf mentions spécifiques, les billets et les photos publiés sur ce site sont placés sous la licence Creative Commons by-sa.

Pour toute utilisation dépassant le cadre de cette licence, merci de me contacter par e-mail.

Login