Country Loop

Country loop lists countries.

{loop type="country" 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"

Loop arguments

Argument Description
area

A single or a list of area ids.

example : area="10,9", area: "500"

exclude

A single or a list of country ids to exclude from the results.

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

exclude_area

A single or list of area IDs. Countries which belongs to these areas are excluded from the results

example : exclude_area="7", exclude_area="3,102,14"

has_states
Thelia >= 2.3

A boolean value to return countries that have states or not (possible values : yes, no or *).

default : *

example : has_states="no"

id

A single or a list of country ids.

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

lang

A lang id

example : lang="1"

order

A list of values for sort order

Expected values :
  • alpha : alphabetical order on title
  • alpha-reverse : reverse alphabetical order on title
  • id : order by ascending id
  • id_reverse : order by descending id
  • random : return countries in pseudo-random order
  • visible : order by ascending visibility
  • visible_reverse : order by descending visibility

default : id

example : order="alpha_reverse"

visible
Thelia >= 2.3

A boolean value to return visible or not visible countries (possible values : yes, no or *).

default : yes

example : visible="no"

with_area

A boolean value to return either countries whose area is defined either all the others.

example : with_area="true"

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 Country
$UPDATE_DATE The last modification date of this Country

Loop outputs

Variable Description
$AREA < 2.2 the area the country belongs
$CHAPO the country chapo
$DESCRIPTION the country description
$HAS_STATES >= 2.3 1 if the country has states, 0 otherwise
$ID the country id
$ISOALPHA2 the ISO 2 characters country code
$ISOALPHA3 the ISO 3 characters country code
$ISOCODE the ISO numeric country code
$IS_DEFAULT 1 if the country is the default one, 0 otherwise
$IS_SHOP_COUNTRY 1 if the country is the shop country, 0 otherwise
$IS_TRANSLATED check if the country is translated
$LOCALE The locale used for this research
$NEED_ZIP_CODE >= 2.3 1 if the country needs a zip code for address, 0 otherwise
$POSTSCRIPTUM the country postscriptum
$TITLE the country title
$VISIBLE true if the country is visible. False otherwise
$ZIP_CODE_FORMAT >= 2.3 The format of the zip code for this country where N is a digit, L a letter and C a state ISO code.