Templating
Global Functions
Website
\Components\Website\Designs \Components\Website\Pages \Components\Website\Pages\Forms \Components\Website\Posts \Components\Website\Posts\Categories
Customers
\Components\Customers\Contacts \Components\Customers\Contacts\Relationships \Components\Customers\Contacts\Relationships\Types \Components\Customers\Groups
Marketing
\Components\Marketing\EmailMarketing \Components\Marketing\Events \Components\Marketing\Events\Attendees \Components\Marketing\Events\Locations
Commerce
\Components\Commerce\Configuration\PaymentMethods \Components\Commerce\Configuration\ShippingMethods \Components\Commerce\Discounts \Components\Commerce\Products \Components\Commerce\Products\Brands \Components\Commerce\Products\Categories \Components\Commerce\Products\Inventory \Components\Commerce\Sales \Components\Commerce\Sales\Items \Components\Commerce\Sales\Receipts \Components\Commerce\Sales\Receipts\Allocations
Settings
\Components\Settings\Administrators \Components\Settings\Domains
Other Apps
\Components\Website\Comments \Components\Commerce\Affiliates \Components\Commerce\Affiliates\Administrators \Components\Commerce\Affiliates\Commissions \Components\Commerce\Affiliates\Payments \Components\Commerce\RecurringSales \Components\Commerce\RecurringSales\StoredCards
Framework
\Framework\Caching\FileBased \Framework\Data\Util \Framework\HTML\Converters \Framework\HTTP\Cookies \Framework\HTTP\Redirection \Framework\HTTP\Request \Framework\HTTP\Session \Framework\HTTP\UserAgent \Framework\I18N\CompanyTypes \Framework\I18N\Countries \Framework\I18N\Languages \Framework\Network\GeoIP

Templating Functions

The following functions can be called within HTML using [? funcname() ?] and from within PHP global scope. Most PHP functions are also available.
varDump()
Dumps / outputs the contents of a variable.

This function is used for debugging or to determine the contents of a variable.

If you have a data repeater that iterates over posts, you can show the contents the post via: [? varDump($post) ?]
Parameters
mixed $mixedVariable Variable
string formatDate()
Reformats a date stamp to be human readable

[? formatDate($post['post_date']) ?]
Parameters
string|int $strTime
string|null $strDateFormat
bool $bNoRelative
Return
string
string formatDateTime()
Reformats a datetime stamp to be human readable

[? formatDateTime($post['post_date']) ?]
Parameters
string|int $strTime The time to format. Can be a timestamp or a string time. Should be in UTC.
bool $bSeparateWithBR Separate the date and time with a <br>.
string|null $strDateFormat A custom date format to use.
string|null $strTimeFormat A custom time format to use.
bool $bNoTZ If true, don't convert to local time.
bool $bNoRelative If true, dont show 'Today', 'Yesterday' for relative times
Return
string
string formatDuration()
Format the difference between two times, displaying as a number of hours, minutes and days as required. Parameters are assumed to be timestamps if integers, or assumed to be strtotime() compatable date strings.
Parameters
int|string $mixedFrom
int|string|null $mixedTo
Return
string
string formatTimeLeft()
Formats the number of time left in seconds

Eg - supplying 600 will return '1 hour'.
Parameters
int $iDifference Number
bool $bShowSmaller
Return
string Number with commas every third digit
string formatNumber()
Formats a number with commas

[? formatNumber(1000, 2) ?] outputs 1,000.00
Parameters
int $iNumber Number
Return
string Number with commas every third digit
convertCurrency()
This function simply converts a price from one currency to another.

[? convertCurrency(100, 'AUD', 'USD') ?]
Parameters
int $iProductPrice
string $strCurrencyId
string $strCurrencyId
string makeHTMLValidName()
Constructs a valid HTML identifier for use in id="" and name="" attributes.

- Characters that are not alpha-numeric are changed to underscores. - If the name starts with a number, and underscore will be prefixed to the name.
Parameters
string $strName Potential HTML identifier
Return
string Valid HTML identifier
string|false makeHTTPRequest()
Make a HTTP request

This function can be used from within a PHP function to fetch data.

<?php

function getBooks($strQuery) { if (\Framework\Caching\FileBased::isCached('Books', $strQuery, 600)) return \Framework\Caching\FileBased::get('Books', $strQuery);

$str = makeHTTPRequest('https://www.googleapis.com/books/v1/volumes?q=' . htmlspecialchars($strQuery));

if ($str) { $arr = json_decode($str, true); \Framework\Caching\FileBased::save('Books', $strQuery, $arr); return $arr; }

return []; }

?>
Parameters
string $strURL URL to request
array|null $arrGET Query string parameters
array|null $arrPOST POST body
array|null $arrHeaders HTTP headers
array|null $arrOtherOpts cURL opts
cURL|null $pCurl Curl reference
Return
string|false Response body
println()
Prints text with a suffixed line break to the client
Parameters
string $str Line