php codes in templates

Author Message

justin kazadi

Thursday 08 May 2008 7:56:49 am

Hello all,

I want to know if it is possible to include the php code in the templates files like this:

<?php

echo"bonjour";

?>

The theory is when we know everything and nothing works.
The practice is when everything works and nobody knows why.
If the practice and theory are met, nothing works and we do not know why.

Albert Einstein

Piotrek Karaƛ

Thursday 08 May 2008 8:41:37 am

No, it's not possible and it is not meant to. You can gain access to your custom PHP code via custom template operators, for example.

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Maxime Thomas

Friday 09 May 2008 2:07:52 am

Hi,

The main point of the Template engine is to provide an abstract layer between your language (PHP) and the view (~HTML). It's useful to help separating the view from the controler in an MVC despign pattern.
So if you put PHP in your templates, you are breaking the abstract layer and by this way the MVC pattern.

Cheers.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas

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