CMS_TEASER
The content type CMS_TEASER is very powerful content type in CONTENIDO.
CMS_TEASER provides creation and configuration of teasers in CONTENIDO backend and output in frontend of the page.
To use CMS_TEASER put the code below in your output modul section.
The name CMS_TEASER specifies which content type should be used and [1] is the index of headline. The index must be integer value.
Â
Note
If you are using more then one CMS_TEASER per article, you have to change/increment index of the next CMS_TEASER.
echo "CMS_TEASER[1]"; or echo "CMS_TEASER[100]";
1.Configuration
The configuration of CMS_TEASER is very powerful, that allows you individualize your teaser.
To configure teaser click on the blue list symbol(see screenshot below). Configuration is splitted in three tabs.
In the first tab Automatic you can set:
- teaser title: here you can set individual teaser title, depends on category you want to show.
- source category: here you can select from the tree which CONTENIDO category should be shown in teaser.
- number of articles: here you can set how much articles you want to see in the teaser.
- teaser startarticle: choose this option if you want see start article of category in your teaser.
- teaser sort: here you can select different metrics for sorting.
- sort order: here you can set sorting of teaser.
After configuration click on green check icon, that will save your configuration. Or click on the red cross to cancel.
In the second tab Manual you can set:
- manual teaser: check this option if you want set manual teaser, means you want have your own collection of articles in teaser from different categories.
- category: select category you want.
- article: select article from selected category.
After selection click on blue plus icon, this icon will put your selection each time in included list.
With red trash icon you can also delete articles from included list.
After configuration click on green check icon, that will save your configuration. Or click on the red cross to cancel.
In the third tab Settings you can set teaser related settings. Which are content visualisation, pictures and content types.
Content visualisation:
- teaser visualisation: here you can select which teaser kind you want to have. By default you have slider, text, image or blog template selections.
Selection can be extendet by client setting, and looks like: type -> cms_teaser, name -> name of your custom template, value -> here is the name of your custom template, which placed in client folder templates(example cms/templates). - teaser filter: this configuration provides filtering of teaser articles. Example: 20 articles are configured, 10 of it has word foo and the rest not. If you enter foo in your settings, you will exclude all articles which has no word foo.
- character lenth: here you can choose the length of your teasered text.
Pictures:
- image width: here you can set width of the teasered picture.
- image height: here you can set height of the teasered picture.
- image scale: this setting provides you scale or crop images.
Content types:
This setting is very important for the teaser. Teaser loads article content from defined content types in this setting.
You have to define here the content type and index, which you use in your articles.
If you dont know which content types are in usage, go to article which you want to teaser, and click on raw data tab(see screenshot below).
2.Teaser template
Teaser templates are high customisable. To view teaser templates go to style -> html.
The name of teaser templates begins with cms_teaser and contains html markup with cTemplate placeholdern, which are filled by content type(see example below).
! At Version 4.10 the first <h2>{TITLE}</h2> will be changed to <h2>{TEASER_TITLE}</h2>
<div class="column_quarter text"> <h2>{TITLE}</h2> <!-- BEGIN:BLOCK --> <div class="col"> <h3>{TITLE}</h3> <span class="date">{PUBLISHED}</span> <p>{TEXT}</p> <a href="{ART_URL}" class="more" title="{TITLE}">{MORE} »</a> </div> <!-- END:BLOCK --> <div class="clear"></div> </div>
The code between <!-- BEGIN:BLOCK --> and <!-- END:BLOCK --> will be executed more then once. It depends how much teaser entries you have.
Possible placeholder which you can use are:
{TITLE} Version 4.9.12 (Outside the BLOCK statement, e.g. for "News")
{TEASER_TITLE} Version 4.10
{TITLE} (inside the BLOCK statement, represents the respective article-headline)
{IMAGE}
{IMAGE_SRC}
{IMAGE_MEDIANAME} Version 4.10
{TEXT}
{ART_URL}
{PUBLISHED}
{PUBLISHED_MANUAL}
{PUBLISHED_COMBINED}
Create your own Template
The default templates are:
- Slider style (cms_teaser_slider.html)
- Image style (cms_teaser_image.html)
- Text style (cms_teaser_text.html)
- Blog style (cms_teaser_blog.html)
Your own image template could be named:
4collumn (cms_teaser_image_4col.html)
- Create a new HTML template (in Style->HTML) with this filename above (cms_teaser_ at first is recommended).
- Go to your client-settings and write this: Type = "cms_teaser", Name = "4collumn", Value = "cms_teaser_image_4col.html"
- Now you will see in your articles editors page, that your teaser-module has a new template to select, called "4collumn"
Thats it.
Â
Methods for CMS_TEASER
List all methods for CMS_TEASER at our API documentation.
Function name | Description |
---|---|
generateViewCode() | Generates the code which should be shown if this content type is shown in the frontend. |
getConfiguredArticles() | Function returns idarts of selected articles as array. |
generateTeaserCode() | Function is called in edit- and viewmode in order to generate teasercode for output. Returns string of select box (if teaser template exists) or array of articles. |
generateEditCode() | Generates the code which should be shown if this content type is edited. |