Difference between revisions of "Zcms:for"

From GruppoZenit
Jump to: navigation, search
Line 20: Line 20:
 
word-wrap: break-word;">
 
word-wrap: break-word;">
 
<zcms:content-form name="formdata" type="INSERT" key="id" action="saveuser" method="post">
 
<zcms:content-form name="formdata" type="INSERT" key="id" action="saveuser" method="post">
 
 
   <zcms:component type="select" attribute="title" >
 
   <zcms:component type="select" attribute="title" >
 
 
       <option value="">Select</option>
 
       <option value="">Select</option>
 
 
       <zcms:for start="1900" end="2050" var="chk" >
 
       <zcms:for start="1900" end="2050" var="chk" >
 
 
         <option  value="[zcms:use:chk]" ><zcms:use name="chk"/></option>
 
         <option  value="[zcms:use:chk]" ><zcms:use name="chk"/></option>
 
 
       </zcms:for>
 
       </zcms:for>
 
 
   </zcms:component>
 
   </zcms:component>
 
 
   <zcms:status event="SUCCESS" url="udaptefrm?id=@@[id]">Inserted</zcms:status>
 
   <zcms:status event="SUCCESS" url="udaptefrm?id=@@[id]">Inserted</zcms:status>
 
 
</zcms:content-form>
 
</zcms:content-form>
 
 
<zcms:submit form="formdata">
 
<zcms:submit form="formdata">
 
 
   <div class="divclass">Click</div>
 
   <div class="divclass">Click</div>
 
 
</zcms:submit>
 
</zcms:submit>
 
</pre>
 
</pre>

Revision as of 13:54, 29 October 2013

zcms:for tag can iterate the contents specified in the body of the tag. Its attributes are the following:

Attribute Definition
start The starting point of the loop
end The ending point of the loop
var The variable to which the current index is stored

Below an example on how to use the "for" tag to create the option from 1900 to 2050:

<zcms:content-form name="formdata" type="INSERT" key="id" action="saveuser" method="post">
   <zcms:component type="select" attribute="title" >
      <option value="">Select</option>		
      <zcms:for start="1900" end="2050" var="chk" >
         <option  value="[zcms:use:chk]" ><zcms:use name="chk"/></option>
      </zcms:for>
   </zcms:component>
   <zcms:status event="SUCCESS" url="udaptefrm?id=@@[id]">Inserted</zcms:status>
</zcms:content-form>
<zcms:submit form="formdata">
   <div class="divclass">Click</div>
</zcms:submit>


See also

Personal tools
Namespaces

Variants
Actions
Toolbox