variable_name._index
to get the current count of how many times you have run through the each loop. _index begins counting from 0. To start counting at 1 use _num
instead.{{ variable_name._length }}
to get the total number of times the loop will run.variable_name._num
to get the current count of how many times you have run through the each loop. _num
begins counting from 1. To start counting at 0 use _index
instead.breadcrumbs
call outputs an automated breadcrumb trail of links, listing the parent pages assigned to the current page. If there are no available links, then an empty span is outputted.{{ current_view }}
call is a unique Zesty.io statement that will load the Page View associated with the current website url. {{ current_view }}
is used once in the loader
snippet. This allows a website to have consistent template elements above and below the unique aspect of each page.else
statement allows for a a final case if none of the defined conditions in the if
statement have been met.else-if
statement is used for the defining alternate conditions, if the original if condition is not met. There can be as many else-if
statements as needed after the opening if
statement and before the end-if
.each
loops.if
statement.escapeForJs()
call returns text with all the characters that could break a Javascript or JSON string escaped with \
..filter()
call can be used to access specific data based on the scope.find_in_set
query allows for looking for a specific number or string in a comma separated list. find_in_set
is always used to filter a Content Model related with a One-to_Many relational field.first()
call will access the content available in the first entry of any content model.format_currency()
call transforms a float number from a content field to the format $XX.XX.get_var
call returns the value of any query parameter in the current URL by referencing the key. When printing out any query parameter using get_var
, be sure to use htmlentities()
to prevent Cross-site Scripts and code injections.content_model_refrence_name-feed.rss/
getImage()
function takes optional arguments for width, height, and type (fit
or crop
) and returns a URL to that image. Fit is the default and does not need to be explicitly declared. Crop type requires all 3 arguments declared. Fit is similar to the css style "contain" and crop is similar to the css style "cover".getImageTitle()
call returns the image title set in the Media Tab.getMediaURL()
call returns the original URL to that file. This is how to access files stored in the Media Tab that are not images, such as PDFs and MP4s. You can also use this call to access the original file of an image without the default optimization provided by Zesty.io.getNextURL()
call returns the current page url with a query parameter p
increased by the number specified. If there is no query parameter p
, it will set it equal to the number specified. If no number is provided, the default is 5. This can be used with get_var.p
to do pagination with an each loop.getPreviousURL()
call returns the current page url with a query parameter p
decreased by the number specified. If there is no query parameter p
, it will set it equal to 0. If no number is provided as an argument, the default is 5. This can be used with get_var.p
to do pagination with an each loop.getUrl()
call returns the relative path to the entry.globals
call is used to access content stored in the Globals (formerly Content Clippings) set.{{gaEvent(eventCategory,eventAction,eventLabel,eventValue)}}
will trigger an event to your Google Analytics integration.gravatar()
function takes an email address and requests an image from the Gravatar API.hasChildren()
function returns true or false, depending if any pages are parented to the entry. This can be used to find out if a page has pages that live under it. This is helpful when using logic to create secondary navigations.html_entity_decode
call converts all HTML entities in the provided string to their applicable characters.htmlentities()
call convert all applicable characters to HTML entities. Should be used whenever printing out a get or post variable to prevent Cross-site Scripting and code injection.if
statement evaluates conditions using ==
, !=
, >=
, <=
, <
, and >
. Within the if
statement, multiple conditions can be combined using &&
for and, and ||
for or. If statements can also execute math.include
call is a prompt to reference the code in any View which includes views, snippets, and endpoints.last()
call will access the content available in the last entry of any content model.limit
statement is used in an each loop to specify how many content entries will result. The limit
statement can also be used to skip a number of entries and show the next set if two arguments are provided.math()
call executes an equation and returns a number.navigation()
call will access your Zesty.io Navigation Structure and output it as an HTML list.number_format()
call returns a number with the specified number of decimals as the argument. Blank will remove any decimals.obfuscate()
call returns obscure text to web crawlers, like email or phone numbers.xssProtect()
call encode, decodes, strips html and turns characters into entities.page
call represents the content entry for the current page. It provides access to the data associated with the page. Any field in the Content Model can be accessed using this method when on the associated page.buy
, addtocart
and donate
.post_clean()
call replaces \n
\r\n
or \
with a blank string.post_var
call references data available in the requests post body. A couple common ways data can be added to the request post body is by submitting a form with a method="post"
or using javascript POST
. A common practical use for this call is to check is a form has been submitted by checking if the POST variable for the name of a required input is available.preg_replace()
call is a regular expression replacement. To learn more about Regular expression go to http://www.regular-expressions.info/​random()
call is used to reference a random content entry for a content model.replace()
call does a simple replace without any regular expression.sectionlinks()
call looks at the current page and searches up to its top-level parent to create a navigation structure as an HTML list. Depth can be specified by as a numeric argument as sectionlinks(2)
or you can choose not to display the top level page by passing sectionlinks(off)
sever_var
call provides access to some of the most common server variables holding information about headers, paths, and script location. Some available variables are:settings
call returns data stored in the Instance Settings in the Config Tab.{{this.toJSON(depth, showMeta)}}
depth
is an integer for hydration depth, max is 5showMeta
true or false: true
gives all meta, routing, and zuid details, and locale details. false
is just contentinstance
call returns data specific to the instance, such as the CDN URL and the domain or globally relevant data, such as the current data-time or the current language.instance.env
call returns live
for published content and views, and dev
for versioned preview views and content.instance.date()
call returns the current date time and accepts arguments to modify the date based on the PHP data-time. More information available at http://php.net/manual/en/function.date.php​instance.lorem()
call auto generates lorem ipsum placeholder content.instance.searchformatted()
call takes a string and a limit as arguments and outputs instance-wide search results based on meta title, meta description, and path.slugify()
call will concatenate strings by replacing spaces with dashes (-), lowercasing all letters, and stripping out all punctuation.sort by
or order by
statement can be used in an each loop to specify a field of the content model used to sort the content entries and which direction. Multiple fields can be specified using a comma separated list. If no sort is specified, the default is creation date. If no direction is specified ascending is the default.striptags
call will return a string with HTML tags removed. It also acts as a substring method if a start and length parameter are provided.substr()
call takes the text value it is attached to and returns a substring with the desired length. This call takes both positive and negative numbers. Negative numbers, for example, substr(-5)
will return the last five characters in a string. Does not consider whitespace as part of length.subWords()
call returns the first specified number of words from a body of text.trim_zeros()
call with take a number like 8.0000000 and just show 8. It will also trim leading zeros as well so a number like 00800.00 will show 800.truepath()
call will determine the web URL to access a content entry based on a ZUID. Since one-to-one and internal page fields in Zesty.io store ZUIDs, truepath()
is a quick way to access the direct url to that content entry without needing to do an each loop or filter call.truepath()
can be used in each loops as well, for example {{ truepath(this.zuid) }}
or {{ this.zuid.truepath() }}
and you can assign it to a Parsley variable as well.where
statement is used to filter content entries in an each loop. Where
statements use SQL style conditional statements to determine which entries to pass through the loop. A single each can use multiple conditions using and
and or
.