associate PHP to content template?

Author Message

Pascal Specht

Monday 21 July 2008 11:05:24 am

Hello,

I wrote a design template for a content class. I was able to do so using the code below, and it works. Now what I would like is also instantiate some self written PHP class each time the content node is viewed. I'm missing some feature like being able to say what PHP class maps to the content node. Something like the (non existing) Execute statement below... Is there a way to do what I want?

Thanks in advance,
</Pascal>

[embed_xxx]
Source=content/view/embed.tpl
MatchFile=embed/xxx.tpl
Subdir=templates
Match[class_identifier]=xxx
Execute=classes/xxx.php

André R.

Monday 21 July 2008 11:35:07 am

You can do it from within the template with a template operator.

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

Pascal Specht

Monday 21 July 2008 11:51:50 pm

Hi André,

Thanks for your reply, yes that makes sense. I was somehow wondering if there wasn't a mechanism similar to the module mechanism already in place. The product class for example seems to have this kind of behaviour built in. Anyway, I'm going to write a template operator, I know how to do it.

</Pascal>

André R.

Tuesday 22 July 2008 12:52:34 am

:) If you need the code to run when node view is cached as well, then you can use a content read workflow, see eznewsletter for example.

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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.