English فارسی Suomi
Français Nederlands Translate

Campsite 3.4

Campsite: CampsiteModifiers

Campsite Modifiers

In this chapter:
  • Truncating UTF8 strings
  • Date Formatting
  • File Size Formatting
  • Email Obfuscation

Truncating UTF8 strings

The "truncate_utf8" modifier behaves exactly like the Smarty truncate modifier except that it works properly on UTF8 strings. See more details on truncate here:

http://www.smarty.net/manual/en/language.modifier.truncate.php

Date Formatting

The "camp_date_format" modifier formats a date string as specified:

{{ <string>|camp_date_format:"<date_attribute>" }}
{{ <string>|camp_date_format:"<date_format>" }}
where:
<date_attribute> may be one of the following:
  • year: year (four digits)
  • mon: month as a number (1..12)
  • mday: day of the month as a number (1..31)
  • yday: day of the year (1..366)
  • wday: day of the week as a number (0=Sunday..6=Saturday)
  • hour: hour (0..23)
  • min: minute (two digits)
  • sec: seconds (two digits)
  • mon_name: name of the month
  • wday_name: day of the week
<date_format> may contain any printable character; escape " (double quotes) in the date formatting with \ (backslash). E.g.: "%M %e, %Y, \"%W\"" will display the the date like this: July 5, 2008, "Saturday".

The following groups of characters have special meaning:
  • %M - month name
  • %W - weekday name
  • %Y - year (4 digits)
  • %y - year (2 digits)
  • %m - month (01..12)
  • %c - month (1..12)
  • %w - day of the week (0=Sunday..6=Saturday)
  • %d - day of the month (00..31)
  • %e - day of the month (0..31)
  • %j - day of the year (001..366)
  • %D - day of the month with English suffix (1st, 2nd, 3rd etc.)
  • %H - hour in format 00..23
  • %h - hour in format 01..12
  • %l - hour in format 1..12
  • %i - minutes in format 00..59
  • %S - seconds in format 00..59
  • %s - is an alias of %S
  • %p - AM or PM
Constraints:
None

 

File Size Formatting

The "camp_filesize_format" modifier formats an integer in Byte specific multiples:

{{ <integer>|camp_filesize_format:"<filesize_format>" }}
<filesize_format> may take one of the following values:
  • TB: for displaying the size in terabytes
  • GB: for displaying the size in gigabytes
  • MB: for displaying the size in megabytes
  • KB: for displaying the size in kilobytes
  • B: for displaying the size in bytes

 

Email Obfuscation

The "obfuscate_email" modifier obfuscates a string; the email string is obfuscated not to allow spambot web crawlers to find it.

{{ <email_string>|obfuscate_email }}

EDIT