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

Parameter

Values

Default

Description

Required

Sample

item

String

blog_posts

This 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.

No

blog_posts

type

content | blog | all

all

Specifies the page type to filter

content - filters out only content pages
blog - filters out only blog pages
* all - filters out blog and content pages

No

all

page

Positive Integer

1

The 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.

No

1

items_per_page

Positive Integer

"Posts per page" setting located under Store -> Settings -> Blog

The 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).

No

5

limit

Positive Integer

"Posts per page" setting located under Store -> Settings -> Blog

The 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.

No

5

start

Positive Integer

1

The 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.

No

1

search

String

The search term or phrase by which to search the Content items for by title, content and keywords.

No

iPhone

search_field_called

String

The 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.

No

color

search_field_for

String

The 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".

No

red

category_id

Positive Integer

The Internal ID Aurora uses to identify a Content Category.

No

1

parent_content_id

Positive Integer

The 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".

No

5

exclude_content_id

Positive Integer

The 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.

No

2

exclude_content_ids

Array of Positive integers

This operates in the same way as exclude_content_id, however a list of IDs can be provided.

tags

Comma-delimited String

This 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.

No

phone,mobile

date_start

String (yyyy-mm-dd)

Filters items which were created on or after the date provided.

No

2016-02-20

date_end

String (yyyy-mm-dd)

Filters items which were created on or before the date provided.

No

2016-03-15

author_id

Positive integer

The Internal ID Aurora uses to identify a User.

No

1

order_by

date_created or title or views or relevance

date_created

The name of the field by which the Content should be ordered when returning the recordset.

No

title

order_by_ascending

false | true

false

If 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.

No

true

Data Returned

Field

Values

Description

  • *[ item ]**.x

Array( 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_items

Non-negative Integer

The 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_available

Boolean

Whether 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_pages

Non-negative Integer

The 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]_request

Collection

The collection of request parameters. These parameters must be provided in the form as data elements for pagination to work correctly

[ item ]_request.items_per_page

Positive integer

See Accepted Parameters section above

[ item ]_request.page_number

Positive integer

See Accepted Parameters section above

[ item ]_request.exclude_content_id

Positive integer

See Accepted Parameters section above

[ item ]_request.parent_content_id

Positive integer

See Accepted Parameters section above

[ item ]_request.search

String

See Accepted Parameters section above

[ item ]_request.search_field_called

String

See Accepted Parameters section above

[ item ]_request.search_field_for

String

See Accepted Parameters section above

[ item ]_request.author_id

Positive integer

See Accepted Parameters section above

[ item ]_request.date_start

String (yyyy-mm-dd)

See Accepted Parameters section above

[ item ]_request.date_end

String (yyyy-mm-dd)

See Accepted Parameters section above

[ item ]_request.order_by_ascending

String

See Accepted Parameters section above

[ item ]_request.order_by

String

See Accepted Parameters section above

[ item ]_request.category_id

Positive integer

See Accepted Parameters section above

[ item ]_request.tags

Comma-delimited String

See Accepted Parameters section above

[ item ]_request.type

content_item

Container

An array of fields pertaining to a single content item.

content_item.id

Positive Integer

The Internal ID Aurora uses to identify Content.

content_item.title

String

The title of the Blog.

content_item.page_introduction

String

content_item.page_content

String

The main body of the content itself.

content_item.page_comments

Non-negative Integer

The number of comments a Content Item has received.

content_item.meta_title

String

Meta title

content_item.meta_description

String

Meta description

content_item.meta_keywords

String

Meta keywords

content_item.date_created

The date this Post was created.

content_item.count_views

Non-negative Integer

The number of views this Post has received.

content_item.comment_status

Whether or not the Blog is currently open for receiving comments.

content_item.page_filename

String

The filename used for a Blog's URL.

content_item.permalink

String

The 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_url

String

The relative URL for a blog entry.

content_item.author

Container

This is a container for the Author data.

content_item.author.id

Positive Integer

The Internal ID Aurora uses to identify Users.

content_item.author.firstname

String

The first name of the User that is attributed with the creation of the Content Item.

content_item.author.lastname

String

The last name (surname) of the User that is attributed with the creation of the Content Item.

content_item.author.fields

Array( 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.xxx

Variable

content_item.fields

Array( 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.xxx

Variable

content_item.tags

Array( content_tag )

For more details regarding the fields available here, please see the content_tag variable in the Content Blog Tags article.

content_item.categories

Array( 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