Dashboard > RIFE > ... > Templates > Alternative tag syntax > Information > Page Comparison
RIFE Log In   View a printable version of the current page.
Alternative tag syntax


Version 5 by Geert Bevin
on Apr 17, 2006 23:09.


compared with
Current by Steven Grimm
on Jun 16, 2006 07:39.

(show comment)
 
Key
These lines were removed. This word was removed.
These lines were added. This word was added.

View page history


There are 9 changes. View first change.

 RIFE's regular template tag format masks the template engine tags as comments of the native data format is handy in many cases. However, sometimes it's cumbersome to use and it's also not appropriate as content of XML or (X)HTML tag attributes. The latter actually even creates problems when used with XSLT. Additionally, people have different preferences regarding tag syntaxes. All this made use create a collection of alternative tag syntaxes so that everybody is able to at least find one he feels comfortable with.
  RIFE's regular template tag format, which masks the template engine tags as comments of the native data format, is handy in many cases. However, sometimes it's cumbersome to use and it's also not appropriate as content of XML or (X)HTML tag attributes. The latter actually even creates problems when used with XSLT. Additionally, people have different preferences regarding tag syntaxes. All this made use create a collection of alternative tag syntaxes so that everybody is able to at least find one he feels comfortable with.
  
 h4. invisible:
 
 This is the regular tag format. Tags are specially marked XML or (X)HTML comments.
  
 {code:xml}
 <!--I 'common.blueprint'/-->
 <!--V 'content'/-->
 <!--BV 'content'-->
<form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
  <form action="<!--V 'SUBMISSION:FORM:myData'/-->" method="post">
  <!--V 'SUBMISSION:PARAMS:myData'/-->
<input name="name" value="[!V 'PARAM:name'][!/V]" />
  <input name="name" value="<!--V 'PARAM:name'--><!--/V-->" />
  <input type="submit" value="That's who I am!" />
  </form>
 <!--/BV-->
 <!--B 'welcome'-->
  <div>Hi <!--V 'PARAM:name'/-->, it's <!--V 'day'/-->!</div>
 <!--/B-->
 {code}
  
Notice that in this case we have "<!--" inside our HTML tag attributes. As noted above, this can cause problems. Read on for the solution.
  
 h4. compact:
 
 This format is less verbose than the invisible format. These tags will show up as visible text if you're editing your template in an HTML editor; whether that's a plus or a minus is a matter of taste.
  
 {code:xml}
 [!I 'common.blueprint'/]
 [!V 'content'/]
 [!BV 'content']
  <form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
  [!V 'SUBMISSION:PARAMS:myData'/]
  <input name="name" value="[!V 'PARAM:name'][!/V]" />
  <input type="submit" value="That's who I am!" />
  </form>
 [!/BV]
 [!B 'welcome']
  <div>Hi [!V 'PARAM:name'/], it's [!V 'day'/]!</div>
 [!/B]
 {code}
  
h4. Mixed invisible and compact
  
 This is the most commonly used syntax, and demonstrates the way RIFE supports mixing tag formats as you see fit. The "invisible" format is used everywhere except in the attributes of HTML tags, where the nested "<" could confuse parsers.
  
 {code:xml}
 <!--I 'common.blueprint'/-->
 <!--V 'content'/-->
 <!--BV 'content'-->
  <form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
  <!--V 'SUBMISSION:PARAMS:myData'/-->
  <input name="name" value="[!V 'PARAM:name'][!/V]" />
  <input type="submit" value="That's who I am!" />
  </form>
 <!--/BV-->
 <!--B 'welcome'-->
  <div>Hi <!--V 'PARAM:name'/-->, it's <!--V 'day'/-->!</div>
 <!--/B-->
 {code}
  
 h4. Velocity inspired
  
These tags should look somewhat familiar to people that are used to Velocity. Sadly they will not become invisible if the template is viewed in a browser:
  These tags should look somewhat familiar to people that are used to Velocity. They will not become invisible if the template is viewed in a browser. These tags are safe to use both inside and outside of HTML tag attributes.
  
 {code:xml}
 ${i common.blueprint/}
 ${v content/}
 ${bv content}
  <form action="${v SUBMISSION:FORM:myData:/}" method="post">
  ${v SUBMISSION:PARAMS:myData/}
  <input name="name" value="${v PARAM:name}${/v}" />
  <input type="submit" value="That's who I am!" />
  </form>
 ${/bv}
 ${b welcome}
  <div>Hi ${v PARAM:name/}, ${v day/}!</div>
 ${/b}
 {code}
  
  
 h4. Regular tags inspired
  
 This version uses custom XHTML tags that look exactly the same as the rest of the layout code and that can easily get validation and auto-completion support in IDEs:
  This version uses custom XHTML tags that look exactly the same as the rest of the layout code and that can easily get validation and auto-completion support in IDEs. In this example, we mix the regular tags inspired format with the compact format.
  
 {code:xml}
 <r:i name="common.blueprint"/>
 <r:v name="content"/>
 <r:bv name="content">
  <form action="[!V 'SUBMISSION:FORM:myData'/]" method="post">
  <r:v name="SUBMISSION:PARAMS:myData"/>
  <input name="name" value="[!V 'PARAM:name'][!/V]" />
  <input type="submit" value="That's who I am!" />
  </form>
 </r:bv>
 <r:b name="welcome">
  <div>Hi <r:v name="PARAM:name"/>, it's <r:v name="day"/>!</div>
 </r:b>
 {code}
  
 To make it convenient to use the regular tag variant, you can download the following support files:
  
 DTD file: [http://rifers.org/dtd/template_1_0.dtd]
 tag library descriptor: [http://rifers.org/dtd/rife-template.tld]


Are you enjoying Confluence? Please consider purchasing it today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.1a Build:#515 May 19, 2006) - Bug/feature request - Contact Administrators