Content Loop

Content loop lists contents from your shop.

{loop type="content" name="the-loop-name" [argument="value"], [...]}

Important informations :

* : argument is required
** : at least one of ** marked argument is required

Global arguments

Argument Description
backend_context

Determine if loop is use in backend context.

default : false

example : backend_context="on"

force_return

force return result for i18n tables even if there is no record

default : false

example : force_return="on"

limit

The maximum number of results to display.

example : limit="10"

name *

The loop name. This name must be unique and is used to reference this loop further in the page (see ifloop, elseloop or pageloop)

offset

The first product to display offset. Will not be used if `page` argument is set.

default : 0

example : offset="1"

page

The page to display.

example : page="2"

Text search arguments
Argument Description
search_in

A comma separeted list of field in which the search is performed

Possible values : title, chapo, description, postscriptum

example : search_in="title"

search_mode

the search mode : `any_word` (search any word separeted by a space), `sentence` (the sentence, anywhere in the field) or `strict_sentence` (the exact sentence)

default : strict_sentence

search_term

The term to search

example : search_term="my product"

Loop arguments

Argument Description
current

A boolean value which allows either to exclude current content from results either to match only this content

example : current="yes"

current_folder

A boolean value which allows either to exclude current folder contents from results either to match only current folder contents. If a content is in multiple folders whose one is current it will not be excluded if current_folder="false" but will be included if current_folder="yes"

example : current_folder="yes"

depth

A positive integer value which precise how many subfolder levels will be browse. Will not be consider if folder parameter is not set.

default : 1

example : depth="2"

exclude

A single or a list of content ids.

example : exclude="2", exclude="1,4,7"

exclude_folder

A single or a list of folder ids. If a content is in multiple folders which are not all excluded it will not be excluded.

example : exclude_folder="2", exclude_folder="1,4,7"

folder

A single or a list of folder ids.

example : folder="3", folder="2,5,8"

folder_default

A single or a list of default folder ids allowing to retrieve all content having this parameter as default folder.

example : folder_default="2", folder_default="1,4,7"

id

A single or a list of content ids.

example : id="2", id="1,4,7"

lang

A lang id

example : lang="1"

order

A list of values

Expected values :
  • alpha : alphabetical order on title
  • alpha_reverse : reverse alphabetical order on title
  • created : ascending order on date of content creation
  • created_reverse : descending order on date of content creation
  • given_id : return the same order received in `id` argument which therefore must be set
  • id : order by ascending ID
  • id_reverse : order by descending ID
  • manual : order by ascending position, considering a given folder. `folder` argument must be set
  • manual_reverse : order by descending position, considering a given folder. `folder` argument must be set
  • position : order by ascending position, without considering a parent folder
  • position_reverse : order by descending position, without considering a parent folder
  • random : return contents in random order
  • updated : ascending order on date of content update
  • updated_reverse : descending order on date of content update
  • visible : online items firts
  • visible_reverse : offline items first

default : alpha

example : order="random"

return_url
Thelia >= 2.3

A boolean value which allows the urls generation.

default : yes

example : return_url="no"

title

A title string

example : title="foo"

visible

A boolean value.

default : yes

example : visible="no"

with_prev_next_info

A boolean. If set to true, $PREVIOUS and $NEXT output arguments are available.

default : false

example : with_prev_next_info="yes"

Global outputs

Variable Description
$LOOP_COUNT the current results index, starting from 1
$LOOP_TOTAL the total number of results returned by the loop
$CREATE_DATE The creation date of this Content
$UPDATE_DATE The last modification date of this Content

Loop outputs

Variable Description
$CHAPO the content chapo
$DEFAULT_FOLDER the default folder id for the current content
$DESCRIPTION the content description
$HAS_NEXT true if a content exists after this one in the current folder, following contents positions. Only available if with_prev_next_info parameter is set to true
$HAS_PREVIOUS true if a content exists before this one in the current folder, following contents positions. Only available if with_prev_next_info parameter is set to true
$ID the content id
$IS_TRANSLATED check if the content is translated
$LOCALE The locale used for this research
$META_DESCRIPTION the content meta description
$META_KEYWORDS the content meta keywords
$META_TITLE the content meta title
$NEXT The ID of content after this one in the current folder, following contents positions, or null if none exists. Only available if with_prev_next_info parameter is set to true
$POSITION the content position
$POSTSCRIPTUM the content postscriptum
$PREVIOUS The ID of content before this one in the current folder, following contents positions, or null if none exists. Only available if with_prev_next_info parameter is set to true
$TITLE the content title
$URL the content URL