Invenzzia » Resources / Articles / Sections and data formats in OPT

Sections and data formats in OPT

  • Published on 22 December 2009 09:00:00 GMT, updated over 4 years ago by Tomasz Jędrzejewski
  • pl

This tutorial shows, how to use sections and data formats in Open Power Template, two unique and powerful features that make writing templates much simpler and faster.

Table of Contents

One of the most useful features in template engine Open Power Templare are sections. They are used to display lists, but contrary to ordinary loops known from other template engines and programming languages, it provides lots of unique options that make your life simpler. In this article we are going to show, how to use sections in your projects and what are data formats, another powerful feature which however may cause some problems at the beginning.

Open Power Template 2.0 projects tutorial

Add new comment

You are writing a reply to comment

  • Will not be published | Gravatar supported
  • Type here the name of our group.

Comments

  • Gravatar photo

    #1 Peter Wilson over 4 years ago Reply to this comment

    Good article

    nice tutorial. this is something i needed and it would be nice to see more texts like this. i have one question: is it possible to read the section data from the variable, but different than the section name with array format?

    • Gravatar photo

      #1.1 Zyx about 17 hours later

      Re: #1

      Yes, it's possible. Use the `datasource` section attribute:

      ~~~~
      <opt:section name="foo" datasource="$bar">

      </opt:section>
      ~~~~

      Just remember that OPT ignores the "parent" attribute then and does not link it with the parent section, if your section is nested.