Start page
Start page
Start page

Start page / Advanced topics / Content highlighting / InplaceAttributeBegin/End

WEBeditInplaceAttributeBegin / End

The render format templates WEBeditInplaceAttributeBegin and WEBeditInplaceAttributeEnd are used to provide the content highlighting function at input component level (see also Page Store: Input components). They enclose the input components which are to be highlighted with a border in the integrated preview (inline preview). Pictures are an exception: in this case the render format templates are part of the picture and do not enclose it (see below).

The variable name of the input component which is to be output must be given as the mandatory parameter.

WEBeditInplaceAttributeBegin and WEBeditInplaceAttributeEnd can be used in page, section and table templates. Each WEBeditInplaceAttributeBegin expression must be closed again by a WEBeditInplaceAttributeEnd expression. Nesting should not be used at all: each WEBeditInplaceAttributeBegin should be closed again with WEBeditInplaceAttributeEnd first before the next WEBeditInplaceAttributeBegin.

WEBeditInplaceAttributeBegin and WEBeditInplaceAttributeEnd should directly enclose the output of the input component, which is usually implemented in the HTML channel with $CMS_VALUE(...)$:

$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_text")$
$CMS_VALUE(st_text)$
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$

Nesting

Formatting
Tags for formatting or text structuring, such as the heading level (e.g. <h2>...</h2>) can either enclose WEBeditInplaceAttributeBegin/End or directly enclose the output of the input component with $CMS_VALUE(...)$.

<h3>
$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_headline")$
$CMS_VALUE(st_headline)$
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$
</h3>

or

$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_headline")$
<h3>$CMS_VALUE(st_headline)$</h3>
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$

In the first example, the text structuring information of the <h...> tag is also valid for the highlighting border. In the second example, the paragraph break of the inside <h...> tag effects the height of the border: while the border in the first example is displayed directly around the output of the st_headline input component, in the second example it has a clearance at the top and bottom.

Instructions
If content of an input component which is to be highlighted is output dependently, for example with $CMS_FOR(...)$ or $CMS_IF(...)$, the correct order or nesting of WEBeditInplaceAttributeBegin/End and the respective instructions must be noted and followed:

A check, whether the respective input component is empty or not, is performed outside of WEBeditInplaceAttributeBegin/End, e.g.

$CMS_IF(!st_headline.isEmpty)$
$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_headline")$
$CMS_VALUE(st_headline)$
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$
$CMS_END_IF$

If the output of the content of an input component is tied to a condition, the condition should be located within WEBeditInplaceAttributeBegin/End, e.g.:

$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_linklist")$
$CMS_FOR(link,st_linklist)$
$CMS_VALUE(link)$
$CMS_END_FOR$
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$

All content which is to be highlighted in addition to the content of an input component must also be located within WEBeditInplaceAttributeBegin/End, e.g. links:

$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"cs_teaser")$
<p><a href="$CMS_REF(ss_press_releases_details,contentId:#row.getId())$">
$CMS_IF(!#row.Teaser.isEmpty)$$CMS_VALUE(#row.Teaser.convert2)$
$CMS_END_IF$
more
</a></p>
$CMS_RENDER(template:"WEBeditInplaceAttributeEnd")$

Highlighting pictures

As a default, WEBedit render format templates surround the content which is output with a div tag. However, pictures – especially in layouts, in which text flows (wraps) around them – are not correctly highlighted.

For correct highlighting, the highlighting information must be added directly in the img tag. For this reason, WEBeditInplaceAttributeBegin/End is used with the additional parameter pure:true. It must be given with both WEBeditInplaceAttributeBegin and WEBeditInplaceAttributeEnd. The call of WEBeditInplaceAttributeBegin must take placewithin the img tag.

In the format template WEBeditInplaceAttributeBegin, the pure:true parameter returns the following control information:

  • id="FSID:...": returns the picture's ID
  • fs:attrs="FSID:...": If the optional view parameter is set, this expression returns the relevant data source.

In the format template WEBeditInplaceAttributeEnd, pure:true returns the following stylesheet class:

  • fsPreview_default

The WEBeditInplaceAttributeEnd call must therefore take place within the class attribute.

The output of a picture with corresponding highlighting can look like this:

<img$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", name:"st_picture", pure:true)$ src="$CMS_REF(st_picture,res:"TextBildTeaser")$" alt="$CMS_IF(!st_picture.comment.isEmpty)$$CMS_VALUE(st_picture.comment)$$CMS_ELSIF(!st_picture.picture.description.isEmpty)$$CMS_VALUE(st_picture.picture.description)$$CMS_END_IF$" class="$CMS_RENDER(template:"WEBeditInplaceAttributeEnd", pure:true)$" width="160" />

The source text is formed as follows by the use of WEBeditInplaceAttributeBegin/End:

<img id="FSID:.." class="fsPreview" src="..." _default" width="..." alt="...">

As a default, the pure parameter is set to false. In this case, the picture is output within a div container (see example above), whereby WEBeditInplaceAttributeBegin returns the opening div tag, the class/es (class=".."), the ID (id="...") and fs:attrs="..." and WEBeditInplaceAttributeEnd returns the closing </div>.

Highlighting input components from datasets

Datasets are usually entered and maintained centrally in the Content Store, however, they can be output in several places of a website with the help of different table templates and therefore different layouts. In these cases, the link between the workspace in which the datasets can be edited using input components and the integrated preview in which the content from these input components is highlighted, is possibly not given automatically (see also Content Store: Input components).

Example: On a company website, press releases or product information is maintained as individual datasets in data sources (content). These are output on the one hand on individual pages (one page per press release or product description), on the other hand on an overview page, on which, for example, only certain content of the datasets is output ("Teasers"). The individual and overview page are based on different table templates, however, only the table template for the individual pages contains the input components for entering and maintaining the datasets. The "Form" tab of the table template for the overview page is empty. In the output, it draws its content from the data source with the individual datasets.

For the table template for which no input components are defined (overview page), several pieces of missing information must be given manually to ensure a correct link between the view in the workspace and the integrated preview; this is done using the content, id, pageRef and view parameters.

All templates which output the same data record must have the same values for these parameters.

These parameters are explained in the following using the given example.

content

This parameter is usually used in templates which output datasets but do not provide any forms for entering data, or for datasets which are output using the contentSelect function. This parameter is used to given the UID of the table template in which the maintenance screen form (forms) is deposited. The content parameter must be used with the index parameter.
In the example, content is used in the table template for the press release overview pages to give the UID of the same table template.

index

This parameter is used to give the ID of the data record which is to be displayed in the workspace, directly in double inverted commas or dynamically, e.g. using the system object #row. This parameter must be used together with the content parameter.

A differentiation is made between the following cases for use of content and index:

  • Content projection (section based on a table template): content and index are filled with default values, but can be manually overwritten.
  • Datasets which are output using the contentSelect function in a content projection: content and index are filled with default values (potentially incorrectly) and can or must be manually changed accordingly.
  • Datasets which are output using the contentSelect function outside a content projection: content and index are not filled with default values and must be given manually.

view

This parameter gives the UID of the data source (content) in the Content Store, in which the maintenance screen form (forms) for the data record are deposited. The parameter must be given in each template via which datasets are output.
In the example, for both templates (for the table template for individual press release pages and for the template for press release overview pages), the view parameter is given with the data source in which the press releases are maintained.

pageRef

This parameter must be given in table templates or in a ContentSelect, which have no maintenance screen forms (forms). It gives the page reference which outputs the corresponding table template with maintenance screen form. The table template is to be selected, via which the same data record is entered / maintained, as that which is output via the table template which has no maintenance screen form.

A page reference object can be transferred to the parameter. Alternatively, the ref(...) function can be used to give the page reference object.

In the example, for the template for the individual press release pages, the parameter pageRef is given as the page reference to a page on which the individual press releases are integrated.

The content, index, view and pageRef parameters must be given with each call of WEBeditInplaceAttributeBegin, e.g.

$CMS_RENDER(template:"WEBeditInplaceAttributeBegin", content:"Products.contacts", index:contactEntity.getId(), view:"kontakte")$

To use the parameters for the whole page, section or table template, $CMS_SET(...)$ can be used before the call of WEBeditInplaceAttributeBegin to define a value for each parameter, e.g.

$CMS_SET(content, "Products.press_releases_overview")$  
$CMS_SET(index, #row.getId())$
$CMS_SET(pageRef, ref(pageref:"pressreleasesdetails"))$
$CMS_SET(view, "pressreleases")$

Mandatory parameters

Parameter

Explanation / Example

name

Specification of the variable name of the input component, which is to be highlighted in the integrated preview, in double inverted commas, e.g.
name:"st_text"

   

Parameters for highlighting pictures

Parameter

Explanation / Example

pure

Parameter for highlighting pictures in the integrated preview,
e.g.
pure:true
The parameter must be set to true for the highlighting of pictures; the parameter does not have to be given for the output of text.
The parameter must be used for both WEBeditInplaceAttributeBegin and for WEBeditInplaceAttributeEnd, namely within the tag. The closing WEBeditInplaceAttributeEnd must be called with class="...".
The default value for pure is false. In this case the picture is output within a div tag.

   

Parameters for highlighting datasets

Important The content, id and pageRef parameters are only required for table templates which output datasets, but do not contain any maintenance screen forms (forms), and for datasets which are output using the contentSelect function.

Parameter

Explanation / Example

content

Specification of the UID of the table template in double inverted commas, in which the corresponding maintenance screen form is deposited, e.g.
content:"Products.product_overview"
This parameter must be used together with the index parameter.

index

Specification of the ID of the data record, which is to be displayed in the integrated preview. The ID is given directly in double inverted commas or, e.g. dynamically using the system object #row , e.g.
index:#row.getId()
This parameter must be used together with the content parameter.

view

Specification of the UID of the data source in the Content Store, which is to be displayed in the workspace if a data record in the integrated preview is clicked, which is rendered by the respective template, e.g.
view:"produkte"

pageRef

Specification of the page reference which is defined in the template with the maintenance screen form (forms), e.g.:
pageRef:ref(pageref:"pressreleasesdetails") or
pageRef:ref(ss_product_details)

   

© 2005 - 2012 e-Spirit AG | All rights reserved. | Last change: 17.07.2009