Forums / Developer / The top 3 "Don'ts" of eZ Publish? Any concepts eZ should let go?

The top 3 "Don'ts" of eZ Publish? Any concepts eZ should let go?

Author Message

André R.

Wednesday 09 February 2011 5:56:06 am

override using remote_id's; yes. Usefull in cases where you export content from one install and import in another one.

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

Carlos Revillo

Wednesday 09 February 2011 2:51:51 pm

Just a note on my side. i agree template language could be better... but i wouldn't like an eZ Publish in which pure php code is merged with html tags.

i've worked with other cms when this is is quite possible (yeah, that cms... :)) and sometimes you see codes in wich mysql_connect sentences are merged with <ul> or <div> tags.

mmm... no, i can't see a eZ Publish having something like

<h1><?php echo $currentnode->attribute( 'name' )?></h1>
<ul>
<?php $nodes = eZContentObjectTreeNode::subTreeByNodeId( array(), $node_id );
foreach( $nodes as $node ) {?>
<li><?php echo $node->attribute( 'name' )?></li>
</ul>
<?php } ?>

It starts there and it ends trying to do sql queries to directly to content tables...

for me separation between content and design is one of the best things of eZ. admiting that some times it's tedious and frustrating, i still don't know a more flexible one in this part.

+1 for adding the voting possible new features.

Paul Etienney

Wednesday 09 February 2011 5:37:26 pm

I totally agree Carlos. The content/design separation is a great concept. When I first discovered ezp, i was super excited to see that the admin was just a different layout. To me this content/design separation and siteaccess are superpowerful concepts to keep.

I am not sure the node / object separation is totally relevant. To me the only case it make sense is when an object is cloned in different location. But i have never used this feature.

-- Good websites creation --
My site : http://www.pauletienney.com
Twitter : http://www.twitter.com/p_etienney

Bertrand Dunogier

Thursday 10 February 2011 1:35:07 am

PHP templates are not THAT bad, it just depends on the coding standards you use. The fact that you can use PHP directly doesn't mean you should use all the features from PHP if you want to maintain readability.

I use them on a project of mine, and this is the kind of code I have:

<h1><?=$title?></h1>
<p class="foo"><?=$content?>
<ul>
  <?php foreach( $items as $item ): ?>
  <li>
    <?php if ( $item->stuff ): ?>
    <a href="<?=$item->link?>"><?=$item->text?></a>
    <?php else: ?>
    <?=$item->text?>
    <?php endif ?>
  </li>
  <?php endforeach ?>
</ul>

This keeps code readable, with the minimal amount of PHP code, and I Have to say I kinda like it.

P.S. I'm by no mean saying we should get rid of a template engine ;-)

Bertrand Dunogier
eZ Systems Engineering, Lyon
http://twitter.com/bdunogier
http://gplus.to/BertrandDunogier

Carlos Revillo

Thursday 10 February 2011 2:13:20 am

I agree with this

"The fact that you can use PHP directly doesn't mean you should use all the features", but on the other hand, my worry is the fact that you can use php directly and this leave, perhaps, more possibility to the developer to go in the wrong way. in other words, i see that like a easier way to introducing hacks in the whole thing... Yeah, perhaps too much strict and too hard to learn, but probably more secure at the end..

and ok, introducing hacks or bad practices is not a problem of phptemplate (in this case). it's a developer problem, but in my opinion, being ez so strict, makes the developer go always in the same railway.

On the other hand, i doubt how flexible could be that. following your example and seeing how i see it in ezpublish, suppose those <li> needs a class for any of your other siteaccess... actually you use fallback design and ok. how should be done with phptemplate, for instance? copying all (html and php) to the new design and so having duplicate code?...

ok, maybe i was a bit crude in my previous post. in fact i use phptemplate sometimes... it's just i wouldn't a thing like that in eZ Publish :).

Cheers.

Maxime Thomas

Thursday 10 February 2011 5:43:21 am

My 2 pences on the template language :

I think the eZC / Zeta Components template engine is cleaner than the one currently implemented in eZPublish. The main features are the following :

  • The template as an interface you must fill to know which variables are set inside the template. It is very clean and allow you to rapidly know what can be wrong or not in your template. If you're a noob in eZ, you may ask what are $#node or other subtleties in the template. This can also enforce the good practices and the use of already set data, see "Variables in page layout" in the reference. By the way it can be tricky to implement for eZPublish unless having a kind of big table to store everything.
  • In term of i18n and cache, the components already provide "tied in" components that are doing this. If we don't want to use those, we can still made new functions that handle the former PHP functions / operators.
  • In term of syntax, ezc is closer to PHP syntax than the current eztemplate engine.

What is missing is :

  • The content related functions : attribute_view_gui, node_view_gui and so on. Not so difficult to implement.
  • The dot syntax that is very useful in templates. This allows to either access an object attribute, a value of an array or run a function.

Coding for 2 years now with ezcTemplate, I think it can be the best valuable thing that can happen to eZP.

Maxime Thomas
[email protected] | 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

Maxime Thomas

Friday 25 February 2011 8:35:23 am

Chatting with a colleague : You can definitely remove the Enumeration datatype.

Maxime Thomas
[email protected] | 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