How to minimize the amount of "{" and "}" in template?

Author Message

Wei Dai

Monday 14 July 2008 10:51:17 pm

Hi,
I find this is really inconvenient. For example, that every time I need use "if", I need use {if ...} ... {/if}, even when I was in the { }:
Is there a way to use the following format?

  {def $variable = "hello"
      if  condition
          something
     endif
  }

Right now, I must break the previous template language tag use "}" then use the {if}..

  {def $variable = "hello"
  }
      {if  condition}
          something
       {/if}

This is really not very comfortable.

Certified eZ Publish 4 developer looking for develop information & collaboration.

Piotrek Karaś

Tuesday 15 July 2008 2:08:00 am

Wei,

Could you please explain how can that be so inconvenient?

Also, keep in mind that your code will significantly differ from what other developers are used to. This may be a reason enough not to break the conventions.

Cheers,
Piotrek

--
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

Łukasz Serwatka

Tuesday 15 July 2008 2:58:35 am

Hi,

This is not possible with eZ Publish template language and eZ Template component as well.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

James Stevens

Tuesday 15 July 2008 4:15:48 am

Yes i understand where you are coming from. But i haven't seen any other way of doing it.

It's kind of a tag based language, so coming from ColdFusion you may find it easier than say PHP.

At least it's neater than this...

  <cfif cgi.Remote_Addr DOES NOT CONTAIN "192.168.32.">
    Your Code
  </cfif>

So glad i don't use ColdFusion anymore, it feels like writing a book!

James

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

eZ debug

Timing: Jan 18 2025 11:30:23
Script start
Timing: Jan 18 2025 11:30:23
Module start 'layout'
Timing: Jan 18 2025 11:30:23
Module start 'content'
Timing: Jan 18 2025 11:30:24
Module end 'content'
Timing: Jan 18 2025 11:30:24
Script end

Main resources:

Total runtime0.8745 sec
Peak memory usage4,096.0000 KB
Database Queries64

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0068 588.0469152.6406
Module start 'layout' 0.00680.0038 740.687539.4766
Module start 'content' 0.01060.8622 780.1641637.1172
Module end 'content' 0.87290.0016 1,417.281312.1250
Script end 0.8745  1,429.4063 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00350.4024160.0002
Check MTime0.00130.1542160.0001
Mysql Total
Database connection0.00120.132310.0012
Mysqli_queries0.810692.6979640.0127
Looping result0.00080.0954620.0000
Template Total0.836495.620.4182
Template load0.00210.234920.0010
Template processing0.834395.402720.4171
Template load and register function0.00020.028210.0002
states
state_id_array0.00120.139410.0012
state_identifier_array0.00200.224020.0010
Override
Cache load0.00180.2021290.0001
Sytem overhead
Fetch class attribute can translate value0.00090.098240.0002
Fetch class attribute name0.00110.124470.0002
XML
Image XML parsing0.00150.170540.0004
class_abstraction
Instantiating content class attribute0.00000.001570.0000
General
dbfile0.00110.1298300.0000
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs