|
zurgutt -
|
Tuesday 15 December 2009 7:29:34 am
Comment56255
"
It makes whole pagelayout less complex moving complex template code outside of it. Hope it is not so difficult to understand that point for you? Instead of heaving 50 lines of code, we simply get data from ezpagedata() template operator. Simple and clean.
"
I apologize for the acid blast earlier, let the frustration to get better of good manners. Sorry. About $pagedata making things simpler, I vehemently disagree. It is true it makes template code shorter and probably faster, however it also makes it much much harder to understand and debug, because page construction logic is done behind the closed curtains in php. Specific example. I tried to add left menu to the frontpage class. I expected it to be simple - disabled the HideLeftMenuClasses[]=frontpage ini setting. No luck. Looked for overriding ini settings, no luck. Debugged the setting in template, seemed correct. Started to look at template code. Totally unfamiliar. {if $pagedata.left_menu}, hm.. what could it mean? Where does $pagedata come from? Digging deeper in template it gets more confusing. Ok, im somewhat experienced, i could locate the ezpagedata.php and look at code. It is hard to make sense of - there are some comments but they are very terse and assume a general knowledge of what is going on anyway, so no help. Debugging the left_menu setting through it finally is revealed, that value from some mystery variable "$parameters" resets its value. Where does it come from? I search the kernel code, nothing. Finally grep the whole installation and find some matches in templates, in extension/ezwebin/design/ezwebin/override/templates/full/frontpage.tpl Searching more, i find this brief mention in extension/ezwebin/settings/menu.ini (not in base ini, where one would look for comments):
# DEPRICATED: use persistent_variable in node full veiw instead
# {set scope=global persistent_variable=hash('left_menu', false(),
# 'extra_menu', false(),
# 'show_path', false())}
[MenuSettings] HideLeftMenuClasses[] Well, deprecated means that old way should still work, but apparently it is overriden by new. So i add it to my frontpage.tpl override and finally get a left menu. My point is, if radical changes like that are done to template flow, which are not obvious by looking at templates, they should be abundantly commented both in template and php code. Otherwise many people are going to be very unhappy after losing hours of time tracking this down. If they are capable to do it at all. There is no way a beginner user could figure this out. So it could be extremely helpful if you:
- Create a documentation page, thoroughly explaining this variable and new way of compiling pages.
- Mention this variable in "variables in pagelayout" section of docs, linking to detailed docs page.
- Mention it in release notes, with link to docs.
- Add a comment about usage of this variable in beginning of pagelayout.tpl, linking to the docs.
thanks
Certified eZ developer looking for projects.
zurgutt at gg.ee
|