Separating the Definition of Editable Region from its Display

Separating the Definition of Editable Region from its Display

Separating the Definition of Editable Region from its Display

On: 1st Jan, 14

Category: Development

Tags: Template, Editable

Comments: 1

In the examples above we have been creating the editable regions exactly at the spot where we wanted their outputs to appear. In effect we have been using the editable tag to both define the editable regions as well as to display their contents.

In complex templates (clonable templates, specifically) with several editable regions it is sometimes more manageable to define all the editable regions together at a single place.

For such cases, we can use the editable tag to only define the editable regions and use the show tag to display the contents.
A good practice is to define together all editable regions used by the template somewhere at the very top of the template -

<cms:template title='Index' clonable='1' >
  <cms:editable name="body" label="Body" type="richtext" />
  <cms:editable name="excerpt" label="Excerpt" type="textarea" />
</cms:template>

The editable tags themselves can be enclosed within template tag (more about it in a little while) because this is a key tag in clonable templates and also because this tag has no output of its own and thus it 'swallows up' the default output of the enclosed editable tags, which otherwise would have appeared on the webpage.

If you do not wish to enclose the editable tags within template tag, set the hidden parameter of each to '1' and this will turn off the output of the tags.

The content of these editable regions can be displayed where ever required by using the show tag -

<cms:show body />
<cms:show excerpt />

1 Comments

admin On: January 8, 2014

This is 1st comment


Allowed HTML tags:
<a><br><strong><b><em><i><blockquote><pre><code><ul><ol><li><del>


CAPTCHA Image
Reload Image