FAQ Q221: Which tags can I use universally, wherever tags are allowed?

Sezione: Templates, tags and CSS styles
You can use the following universal tags in all templates in planyo. You can easily test the tags in the tag playground.

Text and image manipulation

Tag nameMeaning
$(tolower:XXX), $(toupper:XXX), $(ucfirst:XXX)prints the XXX text converted to upper or lower case. The third tag capitalizes the first letter. For example, $(toupper:Hello) yields HELLO.
$(format_price:XXX), $(format_price_decimal_comma:XXX), $(format_price_space:XXX), $(format_price_quote:XXX), $(format_price_space_decimal_comma:XXX)Formats a price with grouped thousands. $(format_price:XXX) uses dot as decimal point and comma as thousands separator while $(format_price_decimal_comma:XXX) does the other way round. $(format_price_space:XXX) uses space as thousands separator and $(format_price_quote:XXX) uses the single quote character. For example, $(format_price:EUR 10500.458) prints 'EUR 10,500.46', $(format_price_decimal_comma:EUR 10500.458) prints 'EUR 10.500,46', $(format_price_space:EUR 10500.458) prints 'EUR 10 500,46', $(format_price_quote:EUR 10500.458) prints 'EUR 10'500.46'.
$(qrcode:XXX), $(qr_ZOOM:XXX), $(barcode:XXX), $(barcode_TYPE:XXX)generates an image with the 2d QR (Quick Response) code representation of the XXX text or a 1d barcode. In case of the $(barcode) tag, you can specify the type of the 1d/2d barcode (e.g. C39, C39E, C39PLUS, C39EPLUS, S25, I25, C128, EAN2, EAN5, EAN8, EAN13, MSI, PHARMA, DATAMATRIX and many more can be used). Here's an example which encodes a URL $(qrcode:http://www.planyo.com/). Of course you can use other tags inside of this tag, e.g. $(qrcode:$(site_url)) or $(qrcode:$(reservation_id)). The $(qr_ZOOM:XXX) tag will also generate a QR code but you can customize the image size by setting ZOOM to 1 or a higher number (number of pixels per dot), e.g. $(qr_1:abc) will generate the smallest possible QR image.

If you're based in Switzerland and you want to generate Swiss QR-bills, see Q358
$(left_N:text), $(right_N:text)Returns the first or last N characters from given text. E.g. $(left_2:planyo) returns pl.
$(nobr:text)Removes new lines (BR and P tags) from the text.
$(nl2br:text)Replaces newlines with BR tags.
$(br2nl:text)Replaces BR tags with newlines.
$(strlen:text)Length of text in characters.
$(replace_text:T1:T2:STR)Replaces all occurrences of T1 with T2 in the text STR
$(urlencode:text)URL-encodes text so it can be safely used in a URL parameter

Mathematical operations

Tag nameMeaning
$(calc:XXX)prints calculated result of the expression XXX. For example, $(calc:2+7) yields 9; $(calc:$(quantity)+1), where $(quantity) is the number of reserved resources (on templates that have access to reservation details), prints the number equal to $(quantity) + 1. Note: if you're inserting price tags inside the $(calc) tag, you will have to wrap the price tag around the $(numeric) tag to first convert it to a numeric value, e.g. $(calc:$(numeric:$(price_quoted))*0.5)
$(numeric:XXX)Converts the expression XXX into a numeric value. Empty or non-numeric value will be converted to 0.Useful inside of the $(calc:xxx) tag if one of the parameters might be e.g. empty
$(round:XXX)Returns the value of XXX rounded to the full number, e.g. $(round:3.4) prints 3 and $(round:4.6) 5.
$(floor:XXX), $(ceil:XXX)Returns the value of XXX rounded down or up to the nearest whole number, e.g. $(floor:4.77) returns 4 and $(ceil:4.77) returns 5. You can use the floor tag together with a number of other tags to return the age based on the birthdate, e.g. if your form includes a field called birthdate, the age in years can be returned with: $(floor:$(calc:($(print_timestamp:$(date)) - $(print_timestamp:$(prop_birthdate)))/(365*24*3600)))
$(mindigits_D:XXX)Returns the number XXX prefixed with as many zeros as necessary in order for the number to be D characters long. E.g. $(mindigits_4:12) would print 0012.
$(crc32:XXX), $(sha1:XXX)Returns the hash / checksum of a text using CRC32 or SHA1 functions. CRC32 will return only digits while SHA1 will return a hex number which includes digits and letters a-f.

Date and time

Tag nameMeaning
$(date), $(date_and_time)Today's date and date-and-time
$(date_diff+XXX:DDD), $(date_diff-XXX:DDD), $(time_diff+HHH:DDD)Adds or subtracts XXX days from the date DDD and prints the resulting date. For example: $(date_diff+1:$(date)) would print tomorrow's date. $(date_diff-1:$(date)) will print yesterday's date. The $(time_diff...) version works the same way but with dates/times and the offset is expressed in hours, e.g. $(time_diff+2:$(date_and_time)) will add 2 hours to the current date and time.
$(weekday:XXX), $(weekday_number:XXX), $(weekday_1:XXX), $(weekday_3:XXX)where XXX is date, prints a full textual representation of the day of the week in the first case and the day number (1 for Monday up to 7 for Sunday) in the second case. The two extra tags print a short (one or three letters) textual representation of the day of the week. For example, $(weekday:25-08-2011) prints Thursday, $(weekday_1:25-08-2011) prints 'T' and $(weekday_3:25-08-2011) print 'Thu'.
$(monthday:XXX), $(month:XXX), $(month_name:XXX), $(year:XXX), $(date_only:XXX)where XXX is date, prints a date component of this date. Can be either the month day (1-31), month (1-12), month name (January etc.), or year. The last tag prints a formatted date (without the time part).
$(hour:XXX), $(minute:XXX), $(time_only:XXX)where XXX is date/time, prints the hour or minute alone based on a complete date and time or time. The last tag prints a formatted time (without date part).
$(timestamp:XXX), $(print_timestamp:XXX)These tags let you do a convertion between date-and-time and a timestamp (number of senconds since 01.01.1970). $(timestamp...) will convert a timestamp to a formatted date and time and $(print_timestamp...) will convert a date or date and time into timestamp format.
$(printdate_FORMAT_XXX)Prints the date/time in the desired format. XXX is date and FORMAT is the date format. The date can be either textual date-and-time (e.g. 2016-01-01 or 2016-01-01 12:00) or timestamp (number of seconds since 01.01.1970, e.g. 1451606400). In FORMAT, you can use the characters: Y - 4-digit representation of the year (e.g. 2016), y - two digit representation of the year (e.g. 16), d - 2-digit day of the month with leading zero (01 to 31), j - day of the month without leading zero (1 to 31), D - 3-letter textual representation of the week day (Mon through Sun), l - full textual representation of the week day (Sunday through Saturday), w - numeric representation of the day of the week (0 for Sunday through 6 for Saturday), m - numeric representation of the month, with leading zeros (01 to 12), F - full textual representation of the month (January through December), M - short 3-letter representation of a month (Jan through Dec), n - numeric representation of the month, without leading zeros (1 to 12), a, A - lower- or upper-case am/pm, g - 12h hour, G - 24h hour, h - 12h hour with leading zeros, H - 24h hour with leading zeros, i - minutes with leading zeros. FORMAT can also contain the separators: ' ' - space, '-'- dash, '/' - slash and '.' - dot.

Current context

Tag nameMeaning
$(language)Currently chosen language. This is in form of a 2-letter (ISO 639-1) language code (all capital letters e.g. EN, DE, FR, ES, IT)
$(language_choice), $(language_choice_narrow)Displays a drop-down which customers can use to change current language. This tag can be only used in advanced integration pages. The second version shows a very narrow drop-down, only with the language codes. By default all languages are listed. If you want to limit the languages available in the dropdown, go to regional settings and click the link to limit the languages available to your customers.
$(S_XXX)This tag represents any text visible to your clients. It makes sense to use such tags, e.g. $(S_RESRES) which will output "Make reservation" instead of the plain text version because the text will be translated automatically to client's language. to find out the IDs of given text, you can go to Settings / Customized translation and when you search for texts containing given keyword, you'll see the keyword ID in the left column.
$(current_website)When using this tag in a condition, you can print different code depending on the website where planyo is being used. For simple integration it will be planyo and for advanced integration on your website it will be the current domain name, e.g. www.testreservation.com
$(current_device)One of: mobile, tablet, desktop. This tag is useful for the templates where you'd like to output different content based on user's device.
$(ppp_xxx)This tag lets you read a custom parameter which you added to the attribute string. This can be any parameter but it must be prefixed with ppp_. For example, if your attribute string looks like this: mode=resource_list&ppp_param1=value1, then the tag $(ppp_param1) will be replaced with value1.
$(user_country), $(user_country_code), $(user_currency)Visitor's / user's country (full name), 2-letter country code, and currency of this country
$(country_from_ip:xxxx)Prints the country name based on IP address (where possible). This will be most likely used together with the tag $(ip_address) which works only within the single reservation context: $(country_from_ip:$(ip_address))
$(convert_currency_AAABBB:NNN)Converts an amount from one currency to another. AAA and BBB and 3-letter currency codes and NNN is the amount. E.g. $(convert_currency_USDEUR:$50) would give you the value of $50 expressed in Euro. $(convert_currency_USD$(user_currency):50) displays the value of $50 in user's currency. We update the currency exchange rates daily. Please note we don't support all world currencies.

Login functionality

The login tags below can be used when you're using the advanced integration with the integration into the login system from your CMS, or when using simple integration with templates with the Planyo login.
Tag nameMeaning
$(is_user_logged_in)true if the current user is logged into your website or an empty text otherwise. You normally use this tags together in a conditional statement, e.g.:
$(if) $(is_user_logged_in) $(then) <a href='$(logged_in_reservation_list_url)'>Click to view all your reservations</a> $(endif)
$(logged_in_reservation_list_url) This tag gives you the URL you can use to let the user view all the reservations they entered in the past.
$(logged_in_user_name)First and last name of the logged in user, empty if user is not logged in
$(logged_in_user_email)Email address of the logged in user, empty if user is not logged in
$(logged_in_user_id)ID of the logged in user, empty if user is not logged in
$(logged_in_user_country), $(logged_in_user_country_code)Country (full name) and the 2-letter country code of the logged in user. Empty if user is not logged in.
$(prop_user_xxx)If a user is logged in, their custom user properties can be printed using this tag


Another very useful feature you can use in your templates are conditional statements: $(if) ... $(then) ... $(else) ... $(endif). They allow you to output different code based on a value of any tag. You'll find the details in Q207

See also other related FAQ questions:
Reservation tags
Resource tags
Site tags
Domande frequenti