Content Smarty Functions

Content Functions refers specifically to methods by which you can access the content configured in the Aurora Back-end under Content > All Content, including Content Pages and Blogs, but not presently Vacancies.

Using the functions described in this article it is possible to add a fully functional blog section into any template throughout the Aurora Front-end. This article is intended to describe what Smarty functions are available for this, how to use them and provide a few examples to get you started. You should refer to the Aurora Demo Example templates detailed with each section for more comprehensive working examples, but none of the examples are provided with any support and are for reference only.

Overview

The functions described in this section allows you to place content or entire blog interfaces into any Template on the Aurora Front-end.

👍

This article should be used in conjunction with the Ajax Content Page article in order to support some of the features including, but not limited to, placing comments on a Content Page/Blog Post.

Listing Blog posts / Content pages (contentFind)

Example URL: 

It is possible to list your Blog posts, Content pages or Blog posts + Content pages anywhere in Aurora using the contentFind function.

Accepted Parameters

ParameterValuesDefaultDescriptionRequiredSample
itemStringblog_postsThis is the name of the variable you would like the results of you query placed in. For example, if you set this to "posts" then the items returned by this method will be loaded into a $posts template variable.Noblog_posts
typecontent | blog | allallSpecifies the page type to filter

content - filters out only content pages
blog - filters out only blog pages
* all - filters out blog and content pages
Noall
pagePositive Integer1The number of the page of results you would like to have returned.



The number of items returned per page defaults to the value specified in the "Posts per page" setting located under Store -> Settings -> Blog, but can be overridden using the "items_per_page" parameter if desired.
No1
items_per_pagePositive Integer"Posts per page" setting located under Store -> Settings -> BlogThe number of content items to return per page.



This should be used to retrieve a particular number of items instead of any 'limit' variable. So if you require a list of 50 Content Items, then simply set this to 50 and do not provide a 'page' value (or do provide a 'page' value but set it to 1).
No5
limitPositive Integer"Posts per page" setting located under Store -> Settings -> BlogThe number of content items to return in this request.



The limit parameter has been made available for use along side the start parameter only, but it is recommended that the built-in paging (items_per_page and page) combination be used instead as this is far simpler in nature and provides better support for the automated paging values.
No5
startPositive Integer1The number of the content item to start returning in this request.

e.g. If 3 is provided, then the 3rd item in the result set will be the first to be returned.



The start parameter has been made available for use along side the limit parameter only, but it is recommended that the built-in paging (items_per_page and page) combination be used instead as this is far simpler in nature and provides better support for the automated paging values.
No1
searchStringThe search term or phrase by which to search the Content items for by title, content and keywords.NoiPhone
search_field_calledStringThe case-insensitive name of the Content Field to search.



Aurora Content can be assigned any number of custom Fields in the Aurora Back-end. These fields can be used for filtering by this method.
Nocolor
search_field_forStringThe case-insensitive value to search for in the field described by the search_field_called parameter.



This search will only search for an exact match. This means that it will search for "X" equals "Y", but will not for "X" begins "Y".
Nored
category_idPositive IntegerThe Internal ID Aurora uses to identify a Content Category.No1
parent_content_idPositive IntegerThe Internal ID Aurora uses to identify a Content Item (Blog Post/Content Page).

This ID is used to find any 'child' content items that are configured to 'belong to' said 'parent' content item.

If you wish to retrieve all 'root' Content Items (items with no parent) then set this parameter to 0 (Zero).



This will only return the very next level of content items (children), e.g. if you have content pages set-up as follows, but provide the Parent ID for "Content 1" then you will only receive "Content 2" and not "Content 3":

Content 1 -> Content 2 -> Content 3

To receive "Content 3" you would provide the ID of "Content 2".
No5
exclude_content_idPositive IntegerThe Internal ID Aurora uses to identify a Content Item (Blog Post/Content Page).

This ID is used to avoid returning the Content Item with the specified ID.



This is most often useful when returning a list of articles that are 'related' to the current article being viewed, whereby you wish not to include the item already loaded in said results.
No2
exclude_content_idsArray of Positive integersThis operates in the same way as exclude_content_id, however a list of IDs can be provided.
tagsComma-delimited StringThis comma-delimited string of tags will have Aurora return only content that has any one of the provided tags attached to it.



Only Blogs currently have tags and so if this is provided for a request for a Content Page and not a Content Blog, then it will be ignored.
Nophone,mobile
date_startString (yyyy-mm-dd)Filters items which were created on or after the date provided.No2016-02-20
date_endString (yyyy-mm-dd)Filters items which were created on or before the date provided.No2016-03-15
author_idPositive integerThe Internal ID Aurora uses to identify a User.No1
order_bydate_created or title or views or relevancedate_createdThe name of the field by which the Content should be ordered when returning the recordset.Notitle
order_by_ascendingfalse | truefalseIf set to 'true', then the content items are returned in Ascending order, otherwise they are returned in Descending order.



In combination with the default value set for the "order_by" parameter, this method will return content items in descending date order, delivering the most recently created items first by default.

Please note that if "order_by" parameter is set to "relevance", "order_by_ascending" parameter will have no effect.
Notrue

Data Returned

FieldValuesDescription
[ item ].xArray( content_item )The data returned by this function is saved to the variable named in the item parameter.

This data takes the form of an array of content_item (as described further down in this table).
[ item ]_total_itemsNon-negative IntegerThe total number of items found by this function is saved to the variable named in the item parameter with the addition of "_total_items".

For example, if you set item="posts" then your items will be found in a $posts template variable and the 'total items' will be stored in a $posts_total_items variable.



This is commonly used for showing how many results there are matching a particular query/search when paging, e.g. "1-20 of 650" where 650 is the value returned within the total_items variable.
[ item ]_more_availableBooleanWhether or not there are more items to be returned that were not returned by this request is saved to the variable named in the item parameter with the addition of "_total_items".

For example, if you set item="posts" then your items will be found in a $posts template variable and the 'more available' status will be stored in a $posts_more_available variable.





This is commonly used for deciding whether or not to show the "Next Page" link when listing Content Items.
[ item ]_number_of_pagesNon-negative IntegerThe number of pages available for your request is saved to the variable named in the item parameter with the addition of "_number_of_pages".

For example, if you set item="posts" then your items will be found in a $posts template variable and the 'more available' status will be stored in a $posts_number_of_pages variable.



This is most useful when simply using the default value for items_per_page, so that your calling script(s) can generate their paging as needed without the need to know the specifics about the limits in play.
[ item ]_requestCollectionThe collection of request parameters. These parameters must be provided in the form as data elements for pagination to work correctly
[ item ]_request.items_per_pagePositive integerSee Accepted Parameters section above
[ item ]_request.page_numberPositive integerSee Accepted Parameters section above
[ item ]_request.exclude_content_idPositive integerSee Accepted Parameters section above
[ item ]_request.parent_content_idPositive integerSee Accepted Parameters section above
[ item ]_request.searchStringSee Accepted Parameters section above
[ item ]_request.search_field_calledStringSee Accepted Parameters section above
[ item ]_request.search_field_forStringSee Accepted Parameters section above
[ item ]_request.author_idPositive integerSee Accepted Parameters section above
[ item ]_request.date_startString (yyyy-mm-dd)See Accepted Parameters section above
[ item ]_request.date_endString (yyyy-mm-dd)See Accepted Parameters section above
[ item ]_request.order_by_ascendingStringSee Accepted Parameters section above
[ item ]_request.order_byStringSee Accepted Parameters section above
[ item ]_request.category_idPositive integerSee Accepted Parameters section above
[ item ]_request.tagsComma-delimited StringSee Accepted Parameters section above
[ item ]_request.type
content_itemContainerAn array of fields pertaining to a single content item.
content_item.idPositive IntegerThe Internal ID Aurora uses to identify Content.
content_item.titleStringThe title of the Blog.
content_item.page_introductionString
content_item.page_contentStringThe main body of the content itself.
content_item.page_commentsNon-negative IntegerThe number of comments a Content Item has received.
content_item.meta_titleStringMeta title
content_item.meta_descriptionStringMeta description
content_item.meta_keywordsStringMeta keywords
content_item.date_createdThe date this Post was created.
content_item.count_viewsNon-negative IntegerThe number of views this Post has received.
content_item.comment_statusWhether or not the Blog is currently open for receiving comments.
content_item.page_filenameStringThe filename used for a Blog's URL.
content_item.permalinkStringThe relative URL used to access an individual blog article on the Front-end.



This will often differ from the "page_filename" value as the blog URLs are dependant on the Aurora config and even individual blog settings, as described in the Blog URL Structure article.
content_item.content_complete_urlStringThe relative URL for a blog entry.
content_item.authorContainerThis is a container for the Author data.
content_item.author.idPositive IntegerThe Internal ID Aurora uses to identify Users.
content_item.author.firstnameStringThe first name of the User that is attributed with the creation of the Content Item.
content_item.author.lastnameStringThe last name (surname) of the User that is attributed with the creation of the Content Item.
content_item.author.fieldsArray( String )This is an associative array of fields associated to the Author of the Content Item. There will be one entry in this array for each field configured against the Author/User. These fields can vary wildly and are dependant on how Aurora is being used.
content_item.author.fields.xxxVariable
content_item.fieldsArray( String )This is an associative array of fields associated to the Content Item. There will be one entry in this array for each field configured against the Blog.
content_item.fields.xxxVariable
content_item.tagsArray( content_tag )For more details regarding the fields available here, please see the content_tag variable in the Content Blog Tags article.
content_item.categoriesArray( content_category )For more details regarding the fields available here, please see the content_category variable in the Content Blog Categories article.

Example template code

You can add the following to the selected content's page in Aurora backend :

<p>Sample content find</p>
{contentFind items_per_page="3" item="items" type="content" search="us" exclude_content_ids=[123,124]} 
{include file="content/content-find.tpl.html"}

This template (or its content) can be included in any Front-end Template to list your Blog entries and supports all of the following via the Ajax provided by _js/blog.js:

  • Paging (Next and Previous pages only)
  • Filtering by:
    • Content Category
    • Date (Month)
    • Content Field (Only one field can be filtered by at any one time)
  • Sorted by:
    • Date created
    • Title
    • Views