Articles Tags
All tags described here must be used into the <ion:articles /> iterator tag or in an article view.
articles - article - id_article - title - subtitle - index - count - view - author - author_email - date - content - url -categories - readmore
articles
Iterator tags for articles.
| Attribute | Optional | Values |
|---|---|---|
| type | yes | Type name. Only returns articles from the given type. Important : type="" will return the articles which doesn't have a type. |
| num | yes | Number of article to return. Not compatible with use of pagination. |
| order_by | yes | "SQL order by" clause Example : 'date DESC' will order the articles by date descending |
| pagination | yes | true / false Use of pagination. If pagination tag is used to show the pagination links, this attribute must be set to use pagination in this set of articles. |
| scope | yes | global / parent The global scope will return articles from all website. Parent scope will return articles from current parent page (all child pages articles). |
| filter | yes | Logical filtering of the articles on their base data. Base data are : title, type, author |
| from | yes | One or more page URL, separated by coma. Returns all articles from the given pages URLs. |
article
Container for one article.
This tag is commonly used to use a specific the article view as partial to display the article content (See example above)
If you only wish to display a list of articles within your page view, it is not mandatory to use this tag.
id_article
Returns the article internal ID.
Can be very useful to name some HTML elements (like an image gallery) if multiple occurrences or this element are displayed on the same page.
<ion:id_article />
title, subtitle
See : Shared Tags
index
Returns the article's index, from 1 to the number of articles.
<ion:index />
Example
We wish to display one <hr /> tag at the end of each 3 articles.
<ion:articles> <ion:title tag="h3" /> <ion:content /> <!-- Index's modulo 3 --> <?php if (<ion:index /> % 3 == 0) :?> <hr /> <?php endif;?> </ion:articles>
count
Returns the number of articles.
<ion:count />
view
Returns the view used by the article, relative to the /themes/your_theme/views/ folder or nothing if no view is linked to the article.
<!-- Example of return : default/last_article --> <ion:view />
author
Returns the article author's name.
<!-- Example of return : Ukyo --> <ion:author />
author_email
Returns the article author's email.
<!-- Example of return : my_email@my_domain.tld --> <ion:author_email />
date
Element date, based on defined Ionize date.
If no publication date is defined in Ionize, this tag will return the creation date of the element.
If the format attribute is not set, returns the date with the format : Y-m-d H:i:s .
Example of standard return : 2010-03-29 20:14:55
If one of the following format is used, the corresponding translation will be searched in the /themes/your_theme/language/xxx/date_lang.php file :
- D : Name of the day, on 3 chars.
- l : Name of the day, long.
- F : Name of the month, long
- M : Name of the month, on 3 chars
That means the day and month names will be displayed in the according language, as translated in each translation file.
<!-- Will display : "Mon" if the article's date is monday and the current lang english --> <ion:date format="D" />
| Attribute | Optional | Values |
|---|---|---|
| format | yes | PHP output format If set, returns the date using this format string. |
| tag | yes | Puts the results into the given tag |
| id | yes | Adds the HTML id attributes to the produced tag. |
| class | yes | Adds the HTML class attributes to the produced tag. |
content
Returns the current article text content.
<!-- Display the first paragraph of the content text in a span HTML tag --> <ion:content paragraph="1" tag="span" />
| Attribute | Optional | Values |
|---|---|---|
| paragraph | yes | Limit the content to the defined number of paragraph. |
| auto_link | yes | Set to 'false', disable the content anchor auto linking. from v.0.9.7 |
| tag | yes | Puts the results into the given tag |
| id | yes | Adds the HTML id attributes to the produced tag. |
| class | yes | Adds the HTML class attributes to the produced tag. |
url
Returns :
- The absolute URL to the article or
- The link set through Ionize if this article is a link to something else (a page, an article, an external URL)
<!-- Display the first paragraph of the content text in a span HTML tag --> <h2><a href="<ion:url />"><ion:title /></a></h2>
If more than one language are defined and set to “online” in Ionize, the returned URL will automatically include the current language code.
In edition mode : If you're connected to Ionize as an editor, the URL will include the language code if more than one languages are set. The offline languages code are also included.
Note :
The links added on Articles are not saved in Ionize v0.9.6-rev1. A temporary workaround as been proposed on the forums and is reported to work (thanks to Galtrhan) :
Comment the line 1079 in application/controllers/admin/article.php
//$this->data['link'] = '';
See forum thread (http://www.ionizecms.com/forum/viewtopic.php?id=374)
categories
Returns the articles categories list, with or without link to the category filtering.
Usage example :
<ion:categories from="blog">
<a href="<ion:url/>"><ion:title/></a>
</ion:categories>
readmore
<ion:readmore term="static_translated_term" tag="p" id="my_id" class="my_class" />