Syntax

From ActionApps Documentation
Jump to: navigation, search

Contents

Curly Brackets Syntax Introduction

Note that there are two different ways of accessing the actual value of a field in your design templates. This reference explains the curly bracket syntax, which we encourage you to use extensively, as it's somewhat cleaner. The discussion about the actual differences can be found at the beginning of the Designing_Output_Templates chapter. The {} syntax, also sometimes called in-line alias definition marks up a special action that needs to be taken when rendering the output of a design template. The action is:

Evaluate the expression between { and }, and substitute the whole string including the brackets with the actual result of the evaluation.

Complicated as it may sound, the simplest example which is at the same time the most common usage is this

{headline........}

which simply says:

  • lookup the value of headline........ - that's the evaluation bit
  • and print it - that's the substitution bit

You will see below that an expression enclosed in {} can contain another (nested) expression. For interpreting and designing more complicated expressions correctly, you must remember that ActionApps interprets the innermost expression first.

Below is the list of all the expressions you can use. The developers appologize for the inconsistency in paramater separators - sometimes :, sometimes ?, sometimes ( . Eh...

{(....)} - Syntax for deffered evaluation

This way you are able to pass {..} any aa_expressions to any function instead of using just aliases there.
Example:

{item:6625:{(some text {headline........}...etc.)}}

{#} - Comment

Syntax:

{#<comment>}

as addition to in-line aliases you can {# make comments} which are not displayed in the resulting html code {the result of this expression is always an empty string). It could be nested again, so you can {# comment out _#ALIASES_ as well as fields {headline........} or alias definitions } - nothing of it will appear in the result.


{@} - Loop through multiple values

Loop through multivalues in the field.

{acsiiname} - generates acsii only username or filename from the string

Parameters

@param $text

{aggregate} Operation across set of items (sum, average, ...)

Searches the database for id (long OR short) values and 'glues' them together to form such an aggregate, using a specified function
IDs are separated by hyphens (-)
Function values are: 'sum','avg','concat','count'

Example:

{aggregate:sum:1264897-5489421-5975546:_#RIVERANK}

Will output the total sum of cities that are near a riverbank, suppose we have a slice of Cities with the field riverbank....... containing logical values 1 or 0 according to the near-a-riverbank status of the city

{aggregate:max:{ids:3a0c44958b1c6ad697804cfdbccd8b09}:_#D_APPCNT}

Syntax:

{aggregate:function:ids_string:expression:parameter}

Expression and parameter are optional
You use no expression, when all you need is to count the values, i.e. you use the 'count' function
Parameter is used as a delimeter of values, if the 'concat' function is used and defaults to NULL, so be sure to set it, when you're using 'concat'

Parameters

 @param $function sum | max | min | avg | concat | count | order | filter
 @param $ids_string list of item ids, khich we take into account
 @param $expression the value, we are counting with (like _#NUMBER_E)
 @param $parameter posible additional parameter for the function (like delimiter for the "concat" function)

{ajax} - Allows on-line editing of field content

Syntax

{ajax:<item_id>:<field_id>[:<alias_or_any_code>[:<onsuccess>]]}

Usage

{ajax:{_#ITEM_ID_}:category........}
{ajax:{_#ITEM_ID_}:switch.........1:_#IS_CHECK}
{ajax:{_#ITEM_ID_}:file............:<img src="/img/edit.gif" title="Upload new file"> :AA_Refresh('stickerdiv1')}

Parameters

@param $item_id
@param $field_id
@param $show_alias
@param $onsuccess

Javascript function in prototypejs version obtain the same fourth parameter - onload function - as in jQuery version of the library

{alerts} - manages alerts subscriptions

Syntax

{alerts:<alert_module_id>:<some other parameter>}

The idea is, that this alias will manage all the alerts subscriptions on the page construct on the page, and it displays the form for subscriptions, managing user profile, unsubscribe users and confirm e-mails. At this moment it is just start - it should unsubscribe users and confirm e-mails when added to the page

Parameters

@param $module_id - alerts module id

{alias} - Using alias functions

Modify the value through an alias function. Syntax:

{alias:<the field>:<alias function>:<parameters>}
{alias:<field_id>::asis} - which prints the field exactly as is in the database 
(regardless of HTML/Plain text settings). It is well used in conjunction with
new "Group update" feature , where we often need the field as is.

So, in text (format string) could be the publish date displayed by {alias:publish_date....:f_d:j.n.Y}. There you can use any alias function with any parameters.

The parameters could be nested, so inside curly braces you can use any alias, any other field ({headline........}) or any other in-line alias definition. There is no limit in level of nesting.

Example:

conditional display of date could look:

{alias:switch.........1:f_c:text:{alias:publish_date....:f_d:j.n.Y}<!--:-->::}

or if we have 06/19/2002 alias defined:

{alias:switch.........1:f_c:text:06/19/2002<!--:-->::}


Both this constructs displays date only if switch.........1 is equal to 'text'. ...

{asis}

Return the 'exact' same text, as the one inserted into the database
Example:

{asis:abstract........}

Remember, that it is not the same as {abstract........}, since {abstract........} takes care about HTML/Plain text setting of the field, so the newlines are sometimes replaced by <br>. It is usefull for "Modify content..." feature of Item Manager, for example.

{backlinks} - returns ids of items which links the item

Syntax

{backlinks:<item_id>[:<slice_ids>[:<sort>]]}

Usage

{backlinks:{id..............}}
- returns all active backlinks to the item in all slices in current site
- module sorted by slice and publish_date
{backlinks:{id..............}:6a435236626262738348478463536272:category.......1-,headline........}
- returns all active backlinks from specified slice sorted by category and headline
{backlinks:{id..............}::-}
- All active backlinks without ordering - the quickest way toget ids 

All active backlinks without ordering - the quickest way toget ids

Parameters

@param $item_id   - item to find back links
@param $slice_ids - slices to look at (dash separated), default are all slices within site modules of item's slice
@param $sort      - redefine sorting - like: category.......1-,headline........

{callback} - helper class

Its purpose is just tricky - we can't use preg_replace_callback where callback function has some more parameters. So we use this class as callback

{changed} - List of fields changed during last edit

You can use it for example when you are sending e-mail notifications about

  • the item change, and you want to know, what is changed:

Syntax

{changed:<item_id>}

Usage

The item change, and you want to know, what is changed:
{ifin:{changed:{_#ITEM_ID_}}:category.......2:Category changed to {category.......2}}
You can also use this feature if you want to send e-mail notification only if specific fields are changed:
{ifset:{intersect:{changed:{_#ITEM_ID_}}:category.......2-expiry_date.....}: email text...}
(we use the feature, that no mail is send, when the body of the mail is empty)

Parameters

<item_id>

{changepwd} - manages forgotten password

Syntax

{changepwd:<reader_slice_id>:<some other parameter>}

Parameters

@param $reader_slice_id - reader module id

The idea is, that this alias will manage all tasks needed for change of pwd you just put the {changepwd:<reader_slice_id>:<some other parameter>}

{compare} Comparison printing

Compares two given values and outputs E,L,G, when the values are Equal, the first is Less than or the first is Greater than the second, respectively

returns: 'L' if val1 is less than val2
'G' if val1 is greater than val2
'E' if they are equal 

Syntax:

{compare:Adam:Eve}

Example:

{switch({compare:{last_edit.......}:1125481998})L:less:G:more:equal}

Parameters

$val1
$val2

{conds} - Allows you to call view with conds

Syntax

{conds:<field or text>[:<do not url encode>]}

<do not url encode> the conds are by default url encoded (%22My%20category%22) so it can be used as parameter to view. However - we do not need url encoding for {ids } construct, so for ussage with {ids} use the last parameter and set it to 1

Usage

{view.php3?vid=9&cmd[9]=c-1-{conds:{_#VALUE___}}}
or
{view.php3?vid=9&cmd[9]=c-1-{conds:category.......1}}
or
{ids:5367e68a88b82887baac311c30544a71:d-headline........-=-{conds:category.......3:1}}
see the third parameter (1) in the last example!

Parameters

@param $text

{const} - Reading Category Values

ActionApps Categories and Constants (the obsolete,simple ones) are stored in a special table (not in slice, unlike preferred Related Items). The relation between the table that holds the content and the table that holds the list of constants is done through the "value" of the constant. If you need to lookup another column from this table and you only know the value, you use this function.

Syntax:

{const_<column_name>:<fieldID>}

Where <column name> one of the valid column names listed below, and <fieldID> is a valid Term#Field_IDs which should have a category group associated to it through the Field properties, in other words should be one of the input types that allow user to select from a list of options.

Example:

{const_name:category.......1}
displays name of constant stored in field category.......1
{view.php3?vid=9&cmd[9]=c-1-{conds:{_#VALUE___}}}
or
{view.php3?vid=9&cmd[9]=c-1-{conds:category.......1}}
or
{ids:5367e68a88b82887baac311c30544a71:d-headline........-=-{conds:category.......3:1}}
see the third parameter (1) in the last example!
{ids:5367e68a88b82887baac311c30544a71:d-headline........-=-{conds:{qs:type}:1}}
works also for multivalue variable (type[] $_GET variable in the last example) 


The list of valid values for <column_name>:

const_short_id short_id
const_name name
const_value value (the same as {category.......1} )
const_pri priority number
const_group name of constant group
const_class class (APC parent category)
const_id long constant id
const_description description (defined on hierarchy editor pages)

Parameters

<column_name>
<fieldID>

{constant}

Returns name (or other field) of the constant in $gropup_id with $value

Syntax

{constant:<group_id>:<value(s)>[:<constant_field>[:<value_delimiter>[:<output_delimiter>]]]}

Usage

{constant:AA Core Bins:1}
{constant:AA Core Bins:1:name}                               - the same as above
{constant:biom__categories:{@category........:|}:name:|:, }  - for multiple constants
{constant:ekolist-category:{@category.......1:|}:<a href="http#://ekolist.cz/zpravodajstvi/zpravy?kategorie=_#VALUE##_">_#NAME###_</a>:|:, }
- you can use also constant aliases and expressions	


Parameters

@param $group_id          - constants ID
@param $value             - constant value (or values delimited by $value_delimiter)
@param $what              - name|value|short_id|description|pri|group|class|id|level
or any AA expression using constant aliases _#NAME###_, _#VALUE##_, _#PRIORITY, _#GROUP##_, _#CLASS##_,
_#COUNTER_, _#CONST_ID, _#SHORT_ID, _#DESCRIPT,  _#LEVEL##_
@param $value_delimiter   - value delimiter - used just form translating multiple constants at once
@param $output_delimiter  - resulting output delimiter - ', ' is default for multiple constants

{convert} The text encoding

Syntax:

{convert:text:from:to}

Converts the 'text' from 1 encoding to another
Example:

{convert:some_text:windows-1250:us-acsii}

Parameters

$text 
$from 
$to

{cookie} Eating chocolate chip cookies all day

Syntax:

{cookie:name}

Returns the 'value of the cookie' specified by name

Parameters

$name

{count}

Counts ids or other string parts separated by delimiter It is much quicker to use this function for counting of ids, than {aggregate:count..} since this one do not grab the item data from the database

Syntax

{count:<ids>[:<delimiter>]}

Usage

{count:12324-353443-58921} // returns 3
{count:{ids:6353428288a923:d-category........-=-Dodo}}

Parameters

for offset and length parameters see PHP function array_slice()
@param $ids // item ids separated by '-' (long or short)
@param $delimiter // separator of the parts - by default it is '-', but you can use any one

{credentials}

Usage

{credentials:ThisIsThePassword}

Adds supplied slice password to the list of known passwords for the page, so you can display the content of the protected slice It is usefull for site module, when you need to display protected content Experimental

Parameters

$slice_pwd
$slice_id

{csv} Provide 'safe' CSV

Useful when we try to export a comma-separated-values file, this directive parses the text contained in the 'field' and replaces quotes with double-quotes and \r\n with \n, so that the CSV format is maintained
Example:

{csv:abstract........}

Note that this directive does not output CSV itself, it is just used to provide the accurate format of the string, later to be used in the CSV. Parameters

$text

{date} - (Current) date with specified date format

Syntax

{date:[<format>[:<timestamp>]]}

Usage

{date:j.n.Y}                               - displays 24.12.2008 on X-mas 2008
{date:Y}                                   - current year
{date:m/d/Y:{math:{_#PUB_DATE}+(24*3600)}} - day after publish date
{date}                                     - current timestamp	

Parameters

@param $format         - format - the same as PHP date() function
@param $timestamp      - timestamp of the date (if not specified, current time is used) The parameter could be also in yyyy-mm-dd hh:mm:ss format
@param $zone - 'GMT'   - if the time should be recounted to GMT

{daterange} - Date range mostly for event calendar

Syntax

{daterange:<start_timestamp>:<end_timestamp>:<year_format>}

Usage

{daterange:{start_date......}:{expiry_date.....}} - displays 24.12. - 28.12.2008

Parameters

@param $start_timestamp  - timestamp of the start date
@param $end_timestamp    - timestamp of the end date
@param $year_format      - format - Y, y or empty for 2008, 08 or none. Y is default (2008)

{debug} - Debug or Troubleshoot

Syntax:

{debug[:<text>]}

Because it is sometimes unclear which substitutions are available at a certain point, {debug} will output some hopefully useful information Parameters

<text>

{decrypt} - Decrypts the text using $key as password (mcrypt PHP extension must be installed)

Syntax

{decrypt:<text>:<key>}

Parameters

$text
$key - password

{define} - prints defined named expression

Defines named expression. You can use it for creatin on-line alieases, you can use it for passing parameters between views

Syntax

The {define:name:expr} must be processed before the {var:name} is processed when the page is generated
You can use parameters with {var:name:param1:param2:...:...} the expression then will use _#1, _#2, ... for each parameter, just like:
{define:username:My name is#: _#1} and usage {var:username:Joseph} is already stored in the pagecache

Parameters

@param $parameters - field id and other modifiers to the field

{dictionary} Translate words in a text

This is used when you need to, say, replace each occurence of your website 'URL' by a link to that very same 'URL'
Syntax:

{dictionary:dictionary_slice:output_text:format:conditions}

You can create "dictionary" slice, where each item will contain a word (in keywords........ field!) and url in other field (and possibly any other fields). Then you can use this "dictionary" slice in your own slice to add links to "dictionary words". You can do it by mentioned syntax where:

  • dictionary_slice is id of "dictionary slice"
  • output_text is the text, where you want to search and replace for dictionary words
  • format specifies, how to replace the keyword
  • conditions is optional parameter, where you can filter only subset of used keywords from "dictionary slice". The syntax is normal conds[] array like: conds[0][category........]='myDict'&conds[1]... (simplified as well as extended syntax)

Example:

{dictionary:4394e6117a0d66fee7cb49ffab9015d2:{_#FULLTEXT}:<a href="_#KEYW_URL">_#KEYWORD_</a>}

_#KEYWORD_ is special alias, which could not be defined in the "dictionary slice". The reason, why we use it is, that you can use Multi value field as keyword (in keywords........). It is good to have only one dictionary item for one word (like APC) and then define multivalue for keyword, where you can fill "APC", "apc", "apc.org"... It is important for English, but it is crucial for such languages as is Czech with different kinds of words.

Parameters

@param $dictionaries
@param $text
@param $format
@param $conds 

Notes:

  • Use this feature mainly for fulltexts of item and not in item-listing, since it is quite time consumming (although it is implemented as quick as possible).
  • Contents of 'HTML' tags are not searched, as the content of the block elements H1-6, script and a is neither.
  • Do not use only a part of the string as a search term, for this directive searches for entire words only.

{expand} - unaliases the text - replaces {views} and other constructs

Parameters

@param $number

{expandable}

Syntax

{expandable:<text>:<length>:<add>:<more>:<less>}

Usage

{expandable:some long text:50:...:more >>>:less <<<}

It creates the div and if the text is longer than <length> characters, then it adds <more> DHTML link in order user can see all the text The /javscript/aajslib.php3 shoud be included to the page (by <script src="">)

Parameters

@param $text     - default link text
@param $length   - HTML code displayed as default (in div)
@param $add      - add this to shortened text
@param $more     - "see all text" link text
@param $less     - "hide" link text

{facebook}

Syntax

{facebook:<url>} - "I like" button

Usage

{facebook:{_#SEO_URL_}}

Parameters

@param $url - url of liked page

{field} What was the name of that field?

Returns the name 'property' of the given 'field_id' in the given slice
Syntax:

{field:field_id:property:slice_id}

Note that 'property' not only defaults to name, but presently cannot be set to a different value.
Useful when you're trying to determine the correct name of the field Usage

{field:headline........:name:ebfbc0082a26365ef6cefd7c4a4ec253}
displayes the Name of the headline field in specified slice as defined by administrator of the slice ion the Fieds Admin page
Allowed properties are name, help and alias1 

Parameters

$field_id
$property
$slice_id

{fieldid} - Reading Field Value

Returns the value at position <index> for multivalue fields

Syntax:

{<fieldID>}

where <fieldID> should be 16 chracters long field id which exist in the slice the template is applied to. ActionApps reads the value of that field for a particular item and replaces it (prints it out) as it is in the database.

Example:

{text...........1}

Usage

{fieldid:text:1} - returns text...........1

Parameters

$type
$num
$id_type

{fieldoptions}

Syntax

{fieldoptions:<slice_id>:<field_id>:<values>}

Usage

{fieldoptions}, ...)

displays html <options> as defined for the field. You can specify current values - as single value, or as multivalue in JSON format.

Parameters

@param $slice_id
@param $field_id
@param $values (single string or array in JSON)

{file2text}

Syntax

 {file2text:<url>}


Usage

 {file2text:{file............}}
 {convert:{file2text:{file............}}:utf-8:windows-1250}

Parameters

$url

Reads the content of the DOC, DOCX, PDF or ODT file in the string. You can use it for searching in the file content - store the content in the field by Computed field and the search in this field

  • cache disabled for aajslib.php3 - there we use $_GET['sess_id'], so the content varies - it is uncecheable
  • fixed password check for older SQL perms

{fileinfo} - get parameters (size or type) from the file

Syntax

{fileinfo:<url>:<info>}

Usage

{fileinfo:{file............}:size} - returns size of the file

Parameters

$url
$info

{filelink}

̈́Syntax

{filelink:<url>:<text>}

Usage:

{filelink:{file............}:{text............}:Download#: }
returns: <a href="http://..." title="Document [PDF - 157 kB]">Document</a> [PDF - 157 kB]

Parameters

<url>
<text>

get link to file for download (prints also file size and type)


@author Adam Sanchez

{filter} - Filter ids by the expression

Syntax

{filter:<ids>:<expression>:<equals-to>}

Usage

{filter:4785-4478-5789:_#SLICE_ID:879e87a4546abe23879e87a4546abe23}

Usualy it is much better to use filtering by database - like you do in {ids}, but sometimes it is necessary to filter concrete ids, so we use this Returns only ids, which <expression> equals to <equals-to>

Parameters

@param $ids         - dash separated item ids
@param $expression  - expression for ordering
@param $equals      - numeric | rnumeric | string | rstring | locale | rlocale

{finduniq}

Returns string unique for the slice(s) within the field. Numbers are added if the conflict is found

Syntax

{finduniq:<string>:<field_id>:<unique_slices>:<ignore_item_id>}

Usage

Parameters

@param $string
@param $field_id
@param $unique_slices
@param $ignore_item_id

{fmod} Counting modulos

Example:

{fmod:1:2}

Outputs œ1 because the remainder of the division of the numbers 1 and 2 is 1. (1 / 2 = 0, remainder 1)


{foreach}

Syntax

{foreach:<values>:<output>:<values-delimiter>:<output-delimiter>}

loops through all the <values> and display them formatted by <output> one after other:

Usage

 {foreach:val1-val2:<p>_#1</p>:-:<br>} 
 {foreach:{qs:myfields:-}:{(<td>{_#1}</td>)}} //fields[] = headline........-year...........1 - returns <td>Prague<td><td>2012</td>
 {foreach:2011-2012: <li> <a href="?year=_#1" {ifeq:_##1:{qs:year}:class="active"}>_#1</a></li>}
 {foreach:{changed:{_#ITEM_ID_}}:{( - {field:_#1:name:81294238c1ea645f7eb95ccb301063e4} <br>)}}
 <input ...> in AA standard form now also uses some HTML5 attributes
 

Parameters

$values
$text
$valdelimiter
$outputdelimiter

sitemodule uses better language file

  • fix {ajax} when used with jQuery
  • fixed ajax Upload widget

{formbreak} Dividing input forms

This is ment to divide the input form into several parts, one possibility is to display the form in 'TABS'. Be careful, as you need to make a complete list of all parts at the beginning of the form.
Syntax

{formbreak:<current_tab_name>:<next_tab_name>:...}

The names are separated by ":" and are applied to current and then other tabs. It is useful mainly for the last tab. Example:

<form>
{formbreak:general:addressing:notes}
<input type=text name="name">
<input type=text name="middleName">
<input type=text name="familyName">
{formbreak:addressing}
<input type=text name="AddressLine1">
<input type=text name="AddressLine2">
{formbreak:notes}
<textarea name="notes">Place notes here</textarea>
</form>


Parameters

$part_names

{formbreak} - Label tabs of a multipage input form

~ToDo: Describe {formbreak} usage 

Syntax:

{formbreak:<current_tab_name>:<next_tab_name>:. . .}

Allows to specify the name for all tabs, when using inputform formbreaks. The names are separated by ":" and are applied to current and then other tabs. It is useful mainly for the last tab.


Syntax:

{@field_id[(alias1[,alias2[...]])]:delimiter:expression}

Example:

{@category.......1}

Lists all values in the field category.......1 separated by ", " - like:

Jane, George, Lucy

{@relation.......2:-}

Lists all values in relation field separated by "-":

8a736554e4a325628a6e459349b9b65b-54e4a3256288a7365a6e459b65b93432-288a7365a6e459b65b9343254e4a3256

Useful in expressions using {item} - like:

{item:{@relation.......2:-}:_#HEADLINE:, }

Displays headlines of all related item specified in relation.......2 field

{@category.......1:,:<em>_#1</em>}

All values will be printed inside <em> tag:

<em>Jane</em>,<em>George</em>,<em>Lucy</em>

Note one limitation here - you can't use curly brackets expressions in "expression" parameter - just text, html and aliases. This limitation you can cleer by using alias as shown in the example below.

{@relation........(_#GET_HEAD): ,:_#1}

Another possibility is to use alias to display each value. _#GET_HEAD is alias defined somewhere in current slice using for example f_t, defined as {item:{loop............}:headline}

The result is, that it displays all the related headlines delimeted by comma (since special field {loop............} contain one value from relation........ field.

{@relation.......1(_#URL_REL_,_#NAME_REL)):, :<a href="_#1">_#2</a>}
{@category.......1(const_name,const_value,_#MY_ALIAS):,:_#1 _#2 _#3}

As you can see, you can use more than one alias for each value. Then you refer to the result as _#1 _#2, ... If you are using constants in the category.......1 field, then you can also get another informations from constant definition, like:

const_name, const_value, const_pri, const_group, const_class, const_counter, const_id, const_description, const_short_id, const_level (the same as with {const})


{formbreaktop}, {formbreakbottom}

Syntax

{formbreaktop:xxxxxx:yyyy:....}    alias - split of inputform into parts
{formbreakbottom:xxxxxx:yyyy:....} alias - split of inputform into parts

Parameters

@param $part_name - name of the part (like 'Related Articles')

{formpart} - prints number of current form part

Usage

{formpart:}

{fulltext}

Returns fultext of the item as defined in slice admin

Syntax

{fulltext:<item-ids>}

Parameters

$item_ids

{go} get url based on current state (apc) and query-string paramater (for Site module)

 {go:<query-string>}

Usage:

 {go:xseo1=faq&xseo2=questions}

Returns "/en/faq/questions" (based on your router (AA_Router_Seo)) (we used {go2url} custom function in previous versions of AA. This function is however core function)

Parameters

<query-string>

{header}

Usage

{header:404}
{header:xml} - which returns right http header for xml - Content-Type: text/xml

{hitcounter} - Displays hit statistics for the items

Usage

{hitcounter:days:24457-24474}
{hitcounter:days:{ids:76f59b2023b8a4e8d6c57831ef8c8199:d-publish_date....->-1185919200}}

Parameters

@param $type type of statistics - currently only "days" statistics is implemented
@param $ids item ids (long or short) for which you want to display statistics

{htmlajaxtoggle}

Syntax

{htmlajaxtoggle:<toggle1>:<text1>:<toggle2>:<url_of_text2>[:<position>]}

Usage

{htmlajaxtoggle:more >>>:Econnect:less <<<:/about-ecn.html}

It creates the link text1 (or text2) and two divs, where only one is visible at the time - first is displayed as defaut, the second is loaded by AJAX call on demand from specified url. The URL should be on the same server The /apc-aa/javascript/aajslib.php3 shoud be included to the page (by <script src="">)

Parameters

@param $switch_state_1  - default link text
@param $code_1          - HTML code displayed as default (in div)
@param $switch_state_2  - link text 2
@param $url_of_text2    - url, which will be called by AJAX and displayed on demand (click on the link)
@param $position        - position of the link - top|bottom (top is default)


Parameters

@param $text    - default link text
@param $length  - HTML code displayed as default (in div)
@param $add     - add this to shortened text
@param $more    - "see all text" link text
@param $less    - "hide" link text

{htmlajaxtogglecss}

Syntax

{htmlajaxtogglecss:<toggle1>:<toggle2>:<css_rule_hide>:<url_of_text>[:<css_rule_update>]}

Usage

{htmlajaxtogglecss:+:-:#id_#SITEM_ID:/apc-aa/view.php3?vid=33&cmd[33]=x-33-{_#SITEM_ID}}

It creates the link text1 (or text2) +/- toggle which loads+displays/hides all elements matching the css_rule (#id82422) in our example The /javscript/aajslib.php3 shoud be included to the page (by <script src="">)

Parameters

@param $switch_state_1  - default link text
@param $switch_state_2  - link text 2
@param $css_rule_hide   - css rule matching the element(s) to show/hide (and possibly update)- '#id82422', '.details', '#my-page div.details'
@param $url_of_text     - url, which will be called by AJAX and displayed on demand (click on the link)
@param $css_rule_update - optional css rule matching the element(s) to update if it is not the same as $css_rule_hide
(good for updating table rows,  where we want to show/hide tr, but update td)

{htmltoggle} HTML code for switching the divs

Creates the link text1 (or text2) and two divs, where only one is visible at a time Syntax:

{htmltoggle:<toggle1>:<text1>:<toggle2>:<text2>}

Example:

{htmltoggle:more >>>:Econnect:less <<<:Econnect is ISP for NGOs...}

Parameters:

toggle1default link text
text1HTML code displayed as default (in div)
toggle2link text 2
text2HTML code displayed as alternative after clicking on the link
positionposition of the link - top|bottom (top is default)

The /javscript/aajslib.php3 shoud be included to the page (by <script src="">)

{htmltogglecss}

Syntax

{htmltogglecss:<toggle1>:<toggle2>:<css_rule>}

Usage

{htmltogglecss:+:-:#id_#SITEM_ID:1}

It creates the link text1 (or text2) +/- toggle which displays/hides all elements matching the css_rule (#id82422) in our example The /javscript/aajslib.php3 shoud be included to the page (by <script src="">)

Parameters

$switch_state_1 - default link text
$switch_state_2 - link text 2
$css_rule       - css rule matching the element(s) to show/hide - '#id82422', '.details', '#my-page div.details'
$is_on          - 1 if the code is on as default (default is 0)

{htmlspecialchars} Escaping HTML chars

Outputs the string inputted, converted into an HTML-friendly format
Example:

{htmlspecialchars:"I love that dog" is my favorite <quote> from the movie 'Me, Myself & Irene'}

Prints out:

&quot;I love that dog&quot; is my favorite &lt;quote&gt; from the movie &#039;Me, Myself &amp; Irene&#039;

Note that other conversions than these (5) are 'not' performed. See htmlspecialchars() function in PHP

{icq} Connecting to a user

Displays a clickable image with a customized look that links to the person's chat address.

Syntax:

{icq:<user_id>[:<action>[:<style>]]}

Parameters:

user_id  - ICQ ID of the user
action   - add | message
style    - 0-26 - displayed icon type

Example:

{icq:12345678:message:1}

{ids} Get the short/long ids

Returns the ids (long ids) of all the 'fields' in the specified 'slice' that match the 'condition', appearing in specific 'order'
Syntax:

{ids:<slices>:<conds>[:<sort>[:<delimiter>[:<restrict_ids>]]]}

Example:

{ids:6a435236626262738348478463536272:d-category.......1-RLIKE-Bio-switch.........1-=-1:headine........-}

Parameters:

slicesslice id where we want to search (it is also possible to specify more than one slice in the slice parameter, in this case, separate slices by dash (-). Note that in this case, the input string of condition should be the classical "d" condition (e.g. d-category........-=-1)
condsconditions. You can use "view" - d- format (like d-category.......1-RLIKE-Bio) or "slice" conds[] format (like conds[0][category........]=first&conds[1][switch.........1]=1).
sortordering - like publish_date.... (ascending), publish_date....- (descending)
delimiterdelimiter of the ids (default value is -, which is good for ussage in {item...}, {view...x-..} and other constructs)
restrict_idsdash (-) separated list of ids used as filter - only subset of these ids are returned

Often used together with {item..}:

{item:{ids:...}:_#HEADLINE}

{if}

Numeric comparison with the operator specified by parameter You can as in {ifeq} use multiple conditions - the first matching is returned, then

Syntax

{if:<condition>:<operator>:<test-value1>:<output1>:<test-value2>:<output2>:<default>}

Example

{if:{_#IMGCOUNT}:>:10:big:6:medium:small}

Comparison is allways numeric (also for security reasons)

Parameters

@param $etalon
@param $operator
@param $option1
@param $text1 
(...)
@param $else_text

{ifeq} Printing in the case of equality

If <var1> is equal to <var2>, then print <text>, else prints <else_text>. <(else_)text> could contain _#1 and _#2 aliases for <var1> and <var2>, but you can use any {} AA expression there.
Syntax:

{ifeq:<var1>:<var2>:<text>:<else_text>}

Example:

{ifeq:{xseo1}:about: class="active"}

Now you can use as many $options as you want:

{ifeq:{xlang}:en:English:cz:Czech:Unknown language}

Parameters

$etalon
$option1
$text1
(...)
$else_text

{ifeqfield}

If any value of the (multivalue) $field is equal to $var, then print $text, else print $else_text. $(else_)text could contain _#1 aliases for $var, but you can use any {} AA expression.

Syntax

{ifeqfield:<item_id>:<field>::<text>:<else-text>}

Usage

{ifeqfield:{xid}:category.......1:Nature: class="green"}
{ifeqfield::category.......1:Nature: class="green"} // for current item

Parameters

@param $item_id
@param $field
@param $var
@param $text
@param $else_text

{ifin}

If $haystack contain $needle text, then print $text, else print $else_text. $(else_)text could contain _#1 for $haystack and _#2 for matched $needle

Syntax

{ifin:<string>:<needle>:<text>[:<needle2>:<text2>:...][:<else>]}

Usage

{ifin:ActionApps CMS:CMS:yes:no}

Example

{Ifin:de,ru,cz,pl,en:en:English:cz:Czech:Unknown language}

Parameters

@param $haystack
@param $needle
@param $text
@param $else_text

{ifset} Conditional printing

If there is ANY text in 'condition', then print out the text
Syntax:

{ifset:<condition>:<text>:<else_text>}

Example:

{ifset:{img_height......}: height="_#1"}

The $condition with undefined alias is considered as empty as well

($condition=_#.{8} (exactly) - like '_#HEADLINE')

Parameters

$condition
$text
$else_text

{img} URL modify

Modifies a long image URL to short one for phpThumb script.

Syntax:

{img:<url>:[<phpthumb_params>]:[<info>]:[<param1>]:[<param2>]}

Example - Creates link to modified image using phpThumb - like:

<img src="{img:{img_url.........}:w=150&h=150}">

see http://phpthumb.sourceforge.net/demo/ for phpThumb parameters

Parameters

$image - image url
$phpthumb_params - parameters as you would put to url for phpThumb
see http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php

{imgtext} - Creates image with the specified text

Creates image with the specified text:

Syntax

{imgtext:<width>:<height>:<text>:<size>:<alignment>:<color>::<opacity>:<margin>:<angle>:<background>:<bg_opacity>}

Usage

{imgtext:20:210:My picture text:3:TL:000000::::90}
- returns white 20 x 210px big image with vertical, top-left positioned black text on it

for phpThumb params see http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php (phpThumb library is the part of AA)

Parameters

@param $phpthumb_params - parameters as you would put to url for phpThumb see http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php

 <s> is the font size (1-5 for built-in font, or point size for TrueType fonts)
 <a> is the alignment (one of BR, BL, TR, TL, C, R, L,
 T, B, * where B=bottom, T=top, L=left, R=right,
 C=centre, *=tile); note: * does not work for built-in font "wmt" *or*
 an absolute position in pixels (from top-left corner of canvas to top-left corner of overlay) in format {xoffset}x{yoffset} (eg: "10x20")
 <c> is the hex color of the text;
 <f> is the filename of the TTF file (optional, if omitted a built-in font will be used);
 <o> is opacity from 0 (transparent) to 100 (opaque)(requires PHP v4.3.2, otherwise 100% opaque);
 <m> is the edge (and inter-tile) margin in percent;
 <n> is the angle
 <b> is the hex color of the background;
 <O> is background opacity from 0 (transparent) to 100 (opaque) (requires PHP v4.3.2, otherwise 100% opaque);
 <x> is the direction(s) in which the background is extended (either 'x' or 'y' (or both, but both will obscure entire image))
 Note: works with TTF fonts only, not built-in

{include} - Including External Page

You can use this directive for an inclusion of a remote file or an output of some script

Syntax:

{include(<url>)}

which will be replaced by the output of the HTTP request for the <url> (by the page the URL points at). It a bit like the ssi include directive, or in fact more like a php include statement.

Example 1:

{include(http://www.google.com/)}

Include Google search form in your page.

Example 2:

{include(cgi/counter.pl?id=222)}

as you see here, you can use relative links, although the usefullness of this is questionable since you may not know which page the output of the template will appear at.

Example 3: If you want to include other slices, it could be usefull to pass the URL parameters to the included file. In this case use the special URL_PARAMETERS constant:

{include(fulltext.shtml?URL_PARAMETERS)}</code>

Limitations:

  • It runs only on http:// sites (https:// is not supported before PHP v4.3.0)
  • There is also limited size of included file. The default limit is 400kB, but you can change it by INCLUDE_FILE_MAX_SIZE constant in config.php3.
  • Also you should know, that each include generates one more HTTP request to server, so it may cause performance problems.
--Marek January 9, 2006 19:46 (CET)
Apparently there is more to include:

{include(file)}

{include:file} or {include:file:http}

{include:file:fileman|site}

{include:file:readfile[:str_replace:<search>[;<search1>;..]:<replace>[:<replace1>;..]:<trim-to-tag>:<trim-from-tag>[:filter_func]]}

Parameters

$fn first parameter is filename, second is hints on where to find it

{index}

Returns the value at position <index> for multivalue fields

Syntax

{index:<field-id>[:<index>]}

Usage

{index:category........} - return first value

Parameters

field_id  - id of the field in item
index     - integer index in multivalue array - default 0 (the first one)

{input} - Allows on-line editing of field content

Parameters

@param $item_id
@param $field_id

{inputvar} - Reading names of fields

Prints out the input field of the specified field, exactly as it is specified in Slice Admin
For example, when I want to design a completely new Input Form, I create a new view of this type and, by using the {inputvar} directive, print out individual input fields (checkbox,radio,textarea,..)
Useful when we need two or more input fields on one line of the layout, let's say the given name and the family name, we need to use

Syntax:

{inputvar:input}

Example:

{inputvar:first_name......}{inputvar:surname.........}

Parameters

$parameters - field id and other modifiers to the field

{intersect}

Syntax

{intersect:<ids>:<ids>}

Returns ids1 where will be removed all the ids from ids2 (all dash separated)

Parameters

$set1
$set2

{item} Display field/alias of given item

Syntax:

{item:<ids>:<aa_expression>[:<delimiter>[:<nested_top>[:<nested_bottom>]]]}

Example:

{item:8ebc541d3703e64042cc198e6d0b026c:short_id........}
{item:171055:_#HEADLINE}

Returns field or _#ALIAS___ substitution for item given by short or long id. It is possible to specify more than one ID in ids. ids should be dash "-" separated and could be in short as well as long form.
You can specify also record delimiter as fourth parameter. If not present no delimiter is used.

Example:

{item:53443-54322-53553:_HEADLINE:, }

Often used together with {ids..}, which then emulates some kind of inline views:

{item:{ids:...}:_#HEADLINE}

You can use item to display items in tree as well. In that case you will use tree representation string, just like:

 3234(3443-3678(3872-3664)-3223)-4045

Last two parameters nested_top and nested_bottom could be used for formating.

Practical examle of ussage is for example breadcrumb navigation:

 {item:{xseo1}({xseo2}({xseo3}({xseo4}))): _#HEADLINE:: <a href="_#ITEM_URL">_#HEADLINE</a> >:}

or better

 {item:{xid:path}: _#HEADLINE:: _#HEADLINK >}

However, you will be able to use it for discussions tree as well.

Parameters

$ids_string ids (long or short (or mixed) separated by dash '-')
- now you can also use tree representation like: 3234(3443-3678(3872-3664)-3223)-4045 (see above)
$content
$delimeter
$top
$bottom

{itree} - Display field/alias of given item(s) in tree

Syntax

{itree:<tree-string>:<nested_top>[:<content>[:<delimiter>[:<nested_bottom>]]]}

<tree-string> is generalized version of <ids> for {item} syntax, which is able to hold also tree structure (and is returned by {treestring...} syntax)

Tree representation string could be as simple as "4232" or "6523-6464-6641", but it could be also more complicated tree - just like:3234(3443-3678(3872-3664)-3223)-4045

Example

{itree:{treestring:{_#ITEM_ID_}}:_#2:_#HEADLINE::}
{itree:{xseo1}({xseo2}({xseo3}({xseo4}))): <a href="_#ITEM_URL">_#HEADLINE</a> >: _#HEADLINE}
  or better
{itree:{xid:path}: <a href="_#ITEM_URL">_#HEADLINE</a> >: _#HEADLINE}
{itree:{xid:path}: _#HEADLINK >: _#HEADLINE}

Tree string representation and formating:

Generic tree

  -+-- 1 --+-- 2
   |       |
   |       +-- 3 --+-- 5
   |       |       |
   |       |       +-- 6
   |       +-- 4
   +-- 7
   |
   +-- 8
 represented as: 1(2-3(5-6)-4)-7-8
 printed as: 1 nested_top
             2 content
             3 nested_top
             5 content
             delimeter
             6 content
             3 nested_bottom
             4 content
             1 nested_bottom
             7 content
             delimeter
             8 content

SEO path (like for breadcrumbs - xseo1 --- xseo2 --- xseo3)

  --- 1 --- 2 --- 3
 represented as: 1(2(3))
 printed as: 1 nested_top
             2 nested_top
             3 content
             2 nested_bottom
             1 nested_bottom


Normal list of items

  -+-- 1
   |
   +-- 2
   |
   +-- 3
 represented as:  1-2-3
 printed as: 1 content
             delimeter
             2 content
             delimeter
             3 content

{jabber}

Syntax

{jabber:<user_id>[:<action>[:<style>]]} - and displays Jabber status for the user

Parameters

@param $user_id      - ICQ ID of the user
@param $action       - call
@param $style        - 0-3 - displayed icon type
@see: http://www.the-server.net:8000
@see: http://www.onlinestatus.org/

{javascript} No apostrophes? No problem!

Escapes apostrophes in input string (with a backslash)
Syntax:

{javascript:string}

{join}

Takes unlimited number of parameters and jioins the unempty ones into one string ussing first parameter as delimiter

Syntax

{join:<delimiter>:<val_1>:...:<val_x>}

which takes unlimited (honzam)number of parameters and joins the unempty ones into one string using first parameter as delimiter:

Usage

{join:, :{_#YEAR____}:{_#SIZE____}:{_#SOURCE___}}

Parameters

@param $delimiter
@param $strings...

{lastdisc} - returns the time of last discussion comment on specified item

Usage

 We use it for displaying the box with five most recently commented items:

 {item:{limit:{order:{ids:9887a8a0ca2ab74691a5b41a485453ac}:_#LASTDISC:rnumeric}:0:5}:
 {(
 <tr>
  <td><a href="_#SEO_URL_?all_ids=1">_#HEADLINE</a> </td>
  <td><a href="_#SEO_URL_?all_ids=1#disc">_#D_APPCNT</a></td>
  <td>{date:j.n.y:{_#LASTDISC}}</td>
 </tr>
 )}
 }
 The _#LASTDISC alias is in this case {lastdisc:{id..............}}
 

Parameters

@param $item_id            - the item id of the item, which we investigate
@param $count_item_itself  - bool 1, when we have to count also with the publish date of the item itself

{lastedit} - displays the date of last modificaton of any item in the slice.

Syntax

{lastedit:[<date_format>:[<slice_id>]]}

Parameters

@param $date_format - the format in which you want to see the date
@see date() function of php http://php.net/date like {lastedit:m/d/y H#:i}
@param $slice_id    - the slice which should be checked for last modification. If no slice is specified, then check all the slices

{limit} Subset of IDs list

Allows you to get only the part of ids from the list - like: Syntax:

{limit:<ids>:<offset>[:<length>[:<delimiter>]]}

Offset and length parameters follows the array_slice() PHP function

Example:

{limit:12324-353443-533443:0:1}   // returns 12324
{limit:{ids:6353428288a923:d-category........-=-Dodo}:0:1}


{live} - Allows on-line editing of field content

Syntax

{live:<item_id>:<field_id>:<required>:<function>}

where

<required> explicitly mark the live field as required
<function> specify javascript function, which is executed after the widget is sumbitted

Parameters

$item_id
$field_id

{log} Logarithmic function evaluation

Syntax:

{log:number:base}

Return the logarithmic value of the number, with the base.


{mail} - Sends e-mail conditionally

Syntax

{mail:<condition>:<to>:<subject>:<body>:<encoding>:<sender email>}


Usage

{mail:1:honza.malik@ecn.cz:test mail:{view:24}:utf-8:actionapps@ecn.cz}


Be careful - it can send mail on every page load!

Parameters

$condition 
$to
$subject
$body
$lang
$from
$reply

{mailform} - Sends e-mail conditionaly

Syntax

{mailform:<to>:<subject>:<html-inputs>:<ok-text>:<body>:<lang>:<from>}

Usage

{mailform:honza.malik@ecn.cz:test mail:Your note <input name="note">:You posted <br>_#1<br>Regards<br>ActionApps:utf-8:actionapps@ecn.cz}
Be careful - it can send mail on every page load!

Parameters

$to
$subject
$html
$body
$ok
$lang
$from

{math} - Mathematical Functions

This function allows you to perform some computatation on the values stored in the slice.

Syntax:

{math(<result_formatting>)<description1>:<expression1>:...:<descriptionN>:<expressionN>}

where:

<result_formatting> has 3 parameters separated by '#' (number of decimals # decimals separator # thousands separator)
<description> can be any text or html and is displayed before result of expression ("#:" mean ":")
<expression1> in expression you can use numbers (decimal separator is ".". Aliases can be used of course) and characters: + - / * ^ . ( )

Example 1 - calculate points in a quiz

<img src="red.gif"   height=10 width="
{math(0#,#) : {_#ANSVER1_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%">  _#ANSVER1_ <br>
<img src="blue.gif"  height=10 width="
{math(0#,#) : {_#ANSVER2_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%">  _#ANSVER2_ <br>
<img src="green.gif" height=10 width="
{math(0#,#) : {_#ANSVER3_} / ({_#ANSVER1_} + {_#ANSVER2_} + {_#ANSVER3_})* 100}%">  _#ANSVER3_ <br>

if _#ANSVER1 = 25, _#ANSVER2 = 50, _#ANSVER3 = 250 result will be (respectively):

<img src="red.gif" height=10 width="8%">  25   <br>
<img src="blue.gif" height=10 width="15%">  50   <br>
<img src="green.gif" height=10 width="77%">  250   <br>

Example 2 - cost of ordered services last year

{math(2#,# ) <br>mails=:{_#NOOFEMAI}*{_#EMAPRICE}:
             <br>web=:{_#WWWPRICE}:
             <br>technical support=:{_#NOOFHOUR}*{_#HOURPRIC}:
<br><hr>total={_#NOOFEMAI}*{_#EMAPRICE}+{_#WWWPRICE}+{_#NOOFHOUR}*{_#HOURPRIC}
}

result:

mails=450,00
web=1500,00
technical support=2400,00
----------------------------
total=4350,00


{max} - max value

Accepts two forms of parameters

{max:12:45:8}
{max:[12,45,8]} - JSON form


{md5} - computes MD5 hash

Syntax

{md5:<text>}

{menu} - return prints HTML menu

Designed for SEO sitemodule with "Pages" slice with the relation field "Subpage of..." The menu items with empty text is not printed (which you can use for not displaying some items)

Syntax

{menu:<first-level-item-ids>:<menu-text>:[<relation-field>[:<sort-string>]]}

Usage

submenu for current item:
- {menu:{id..............}:_#MENULINK}
whole real menu for the Pages slice:
- {menu:{ids:18a352366ea922738348478463536ea5:d-relation........-ISNULL-1:number..........}:_#MENULINK:relation........:number..........}

Result

 The menu then looks like: 
 <ul>
  <li> one
   <ul>
    <li> one.1 </li>
    <li> one.2 </li>
   </ul>
  <li> two </li>
 </ul>

Each li contains id="menu-<item_id>" and also class, which indicates, if the menu option is "active" or "inpath" to current "active" item

Parameters

@param $item_ids            - item ids of the menu options on the first level
@param $code                - alias or aa expression which will be printed inside <li></li>
should be link to the item  - _HEADLINK  (for example) if the resulting code is empty, the menu option is not displayed (not its submenu), 
which you can use for not displaying some items
@param $relation_field      - tree relation field (default relation........)
@param $sort_string         - order of tree leaves

{min} - min value

Accepts two forms of parameters

{min:12:45:8}
{min:[12,45,8]} - JSON form

{modulefield}

Syntax

{modulefield:<sice_id>:<field_id>} - returns module/slice field

Usage

{modulefield:8a435116626262738348478463536242:_abstract.......}


Get module (slice, ...) property (currently only "module fileds"(beggining with underscore) and 'name' is supported replacing older {alias:_abstract.......:f_s:slice_info} syntax

Parameters

$slice_id
$property

{next}, {previous} Next/Previous ID in list

Next/Previous item for the current item in the list - like: Syntax:

{next:<ids>:<current_id>}
{previous:<ids>:<current_id>}

Example:

{next:12324-353443-58921:353443}   // returns 58921
{next:{ids:6353428288a923:d-category........-=-Dodo}:566a655e7787b564b8b6565b}


{now} Displaying the current time (server)

Prints the current time, as far as I am concerned it prints out the Unix timestamp (of the current date and time on the server machine) (Current) date with specified date format - alias for {date:...}

Usage

{now:j.n.Y}                               - displays 24.12.2008 on X-mas 2008
{now:Y}                                   - current year
{now:m/d/Y:{math:{_#PUB_DATE}+(24*3600)}} - day after publish date

Parameters

$format
$timestamp

{options} - html <option>s for given constant group or values

Syntax

{options:<group>:<selected>}

Usage

{options:[1,2,5,7]:7}
{options:AA Core Bins:1}
{options:{sequence:num:1998:2012}:{date:Y}}
{options:[[1,"January"],[2,"Feb"],[3,"March"]]:2}

return html <option>s for given constant group or values with selected option


Parameters

 group    - group id or JSON list of values (or value-name pairs)
 selected - the value of <option> which should be selected

{order} - Sorts ids by the expression

Syntax

{order:<ids>:<expression>[:<sort-type>]}

Usage

{order:4785-4478-5789:_#YEAR_____#CATEGORY}
{order:4785-4478-5789:_#HEADLINE:string}

Usualy it is much better to use sorting by database - like you do in {ids}, but sometimes it is necessary to sort concrete ids, so we use this You can sort numericaly (default), as string or using current locale in both directions: numeric | rnumeric | string | rstring | locale | rlocale

Parameters

@param $ids         - dash separated item ids
@param $expression  - expression for ordering
@param $type        - numeric | rnumeric | string | rstring | locale | rlocale

{pager} - page scroller for site modules views

Usage

{pager:resuts}
where result is the div id, in which the view dispays the values
<div id="results">..view output there</div>

It calls router methods, so it displays the right urls in the scroller @see AA_Router::scroller() method Must be issued inside the view Now it is possibile to use {pager} on views called by AJAX (for live searches, ...).

Parameters

@param $property

{polls} - displays current poll from polls module specified by its pid

Syntax

{polls[:<pid>[:<param>]]}

Parameters

@param $pid

{preg_match}- Pattern Matching

--Marek 21 October 2005 20:31 (CEST)
{preg_match} is not in the stable release yet as of today.

Useful for extracting parts of the string that match a certain pattern.

Syntax:

{preg_match:/<pattern>/:<subject>}

where <pattern> is a perl regular expression as described in php preg_match pattern function manual, and <subject> can be any valid ActionApps expression.

Example:

{preg_match:/[0-9]*/:some text with number 25452 in it}

which returns 25452 (based on specified regular expression)

Parameters

$pattern
$subject

{protectmail} - hides mail into javascript

Syntax

{protectmail:<email>[:<text>]}

prints <a href="mailto:<email>"><text></a>, but encoded into javascript to be protected from spambots

Parameters

 @param $email - e-mail to protect
 @param $text  - text to be linked (if not specified, the $email is used)

{pwdcrypt} - crypt text as AA password

Syntax

{pwdcrypt:<text>}

Parameters

$text

{qs} - get GET parameter from URL

 {qs:<varname>}

Usage:

 {qs:surname}

Returns Havel for http://example.org/cz/page?surname=Havel

 {qs}

Returns whole querystring (including GET and POST variables) Parameters

$ids_string
$expression
$delimeter

{quote} - Just escape apostrophs

Parameters

@param $text

{rand} - returns random integer number from min to max

Usage

{rand:min:max}

Parameters

@param $min
@param $max

{randomstring} - random string

 {randomstring:<length>} 

Usage:

 {randomstring:6}

Returns random string of given length.


{recompute} - Recounts all computed field in the specified item (or dash separated items)

Is the command to recompute all the computed fields for specified item ids. You can put it in other computed field in related slice, for example, if you want there recompute the number of links or whatever

Syntax

{recompute:<item_ids>}


Usage

{recompute:ids[:fields]} - in the command for recomputing computed fields in specified item now is able to specify only specific field for recomputing.

Parameters

$item_ids
$fields_ids

{redirect} - Go directly to another url

Redirects user to specified page directly and right in the time it ocures in the code - could be used inside site module, when you need to redirect user to another branch (say from / to /cz/home)

Syntax

{redirect:<url>}

Usage

{redirect:http#://example.org/en/new-page}                - mention the escaped colon in http
{redirect:{ifset:{xid}::http#://example.org/en/new-page}} - for conditional redirect

Parameters

$url

{removeids}

Syntax

{removeids:<ids1>:<ids2>}

Returns ids1 where will be removed all the ids from ids2 (all dash separated)

Parameters

$set1
$set2

{rotator}

Syntax

 {rotator:<item-ids>:<html-code>:<interval>}

Usage

 
 {rotator:{ids:a24657bf895242c762607714dd91ed1e}:_#FOTO_S__<div>_#HEADLINE</div>}
 

Rotates on one place in the page different contents (divs) with specified interval

Parameters

$ids
$code
$interval

{rss} Feeding text

Replaces &nbsp; with whitespace ( ) and the amphersand (&) with &amp;
Syntax:

{rss:string}

Parameters

$text

{rss2html} - reads RSS chanel from remote url and converts it to HTML and displays

Syntax

{rss2html:<rss_url>[:max_number_of_items]}

Usage

 {rss2html:http#://www.ekobydleni.eu/feed/:5}
 or more advanced example with header and encoding change
 <h2><a href="http://www.ekobydleni.eu">www.ekobydleni.eu</a></h2>
 {convert:{rss2html:http#://www.ekobydleni.eu/feed/:5}:utf-8:windows-1250}
 

Used XSL extension of PHP5. PHP must be compiled with XSL support

Parameters

$rss_url
$number

{scroller} - Adding Pagination

If you want to use page scroller (Page 1 | 2 | 3 | ... ) in view which is a part of the site build on Site Module, you can use this construct. You simply add {scroller} to the bottom of the view which you are calling from the site module - most likely the 'Bottom HTML' field. Example : {scroller:Page ::class="blue"}

Syntax :

{scroller:<begin>:<end>:<add>:<nopage>}

Parameters

<begin> text to be shown before page numbers
<end> text to be shown after page numbers
<add>

string to be added inside the page link, e.g. class=
<a href=".." class="blue10v">1</a>

<nopage> text to be shown wnen there are (yet) no pages (so the scroller is not displayed)

Then you use the view include, and also utilize the {p} state variable which stores the page number in the site module's spot:

{view.php3?vid=32&set[]=page-{p},listlen-10}


--Marek February 10, 2006 02:43 (CET)
This needs more documenatation, since I ended up grabbing the {p} like this in my site_xxx.php
if ($scr_725_Go) { // there is probabaly a better way of doing this 
	$p=$scr_725_Go;
}
Is there a better way ?
--Noro March 9, 2006 21:01 (CET)
Try this (from example site script):
if (isset($scrl)) {
   $pagevar = "scr_".$scrl."_Go";
   $apc_state['page'] = $$pagevar;
}

{server} - Get $_SERVER[<variable>] value

Syntax

{server:<param>} which prints $_SERVER variable

Parameters

@param $variable

see http://php.net/manual/en/reserved.variables.server.php

{serverload} - Returns actual server load

Usage

{serverload}


{seo2ids} - returns ids of items based on conds d-...

Syntax

{seo2ids:<slices>:<seo-string>}

Usage

{seo2ids:6a435236626262738348478463536272:about-us}

Parameters

@param $slices
@param $seo_string

returns long id of item in selected slice (or dash separated slices) with the specified SEO string in seo............. field. If there are more such ids (which should not be), they are dash separated

{seoname} - returns seo name created from the string

Returns string unique for the slice(s) within the field. Numbers are added if the conflict is found

Syntax

{seoname:<string>[:<unique_slices>[:<encoding>]]}

Usage

{seoname:About Us:3aa35236626262738348478463536224:windows-1250}
{seoname:{_#HEADLINE}:all}

Parameters

@param $string
@param $unique_slices
@param $encoding
  • Returns about-us
  • If you specify the unique_slices parameter, then the id is created as unique for those slices. Slices are separated by dash
  • Encoding parameter helps convert the name to acsii. You shoud write here the character encoding from the slice setting. The default is utf-8, but you can use any (windows-1250, iso-8859-2, iso-8859-1, ...)

{sequence}

Returns sequence of values in JSON Array (could be used with {options}

Syntax

Usage

{seqence:num:min:limit:step}

Parameters

@param $group_id

{sessurl} - Expand URL by adding session

Syntax

{sessurl:<url>}

Usage

{sessurl}         - returns session_id
{sessurl:hidden}  - special case for <input hidden...
{sessurl:param}   - special case for AA_CP_Session=6252412...

Parameters

@param $url

{set}

Returns ids of items based on Item Set as defined on Admin page

Syntax

{set:<set_id>}

Parameters

@param $item_set

{shorten}

Syntax

{shorten:<text>:<length>[:<mode>[:add]]}

Usage

 {shorten:{abstract.......1}:150}

@return up to <length> characters from the <text>. If the <mode> is 1 then it tries to identify only first paragraph or at least stop at the end of sentence. In all cases it strips HTML tags

Parameters

@param $text   - the shortened text
@param $length - max length
@param $mode   - 1 - try cut whole paragraph - 0 - just cut on length
@param $add    - text added in case the text shorten (so the resulting text will be at maximum length+add long)

{shuffle} - randomises the order of ids

Syntax

{shuffle:<ids>[:<limit>]}

Parameters

@param $ids // parts separated by '-'
@param $limit // number of returned shuffled ids

{site} - Get site module property

(currently only "modules" - dash separated list of slices in the site) I use it for example for computing of seo name:

Usage

{ifset:{seo.............}:_#1:{seoname:{_#HEADLINE}:{site:{modulefield:{_#SLICE_ID}:site_ids}:modules}}}

Parameters

@param $property

{skype} Connecting to a user

Functions similar to {icq}, but the image links us to skype.

Syntax:

{skype:<skype_name>[:<action>[:<style>[:<message>]]]}

Parameters:

skype_name  - skype name of the user
action      - add | call | chat
style       - add | call | chat | smallicon | mediumicon | ballon | bigclassic | smallclassic
message     - a text to display

Example:

{skype:12345:chat:balloon:Skype me}

Outputs:

<a href="skype:12345?chat">   [the appropriate image]  </a>

{slice} - Deprecated - use AA_Stringexpand_Modulefield instead

Parameters

@param $property

Get module (slice, ...) property (currently only 'name' is supported Never cached because of grabbing the slice_id from item or globals however it never mind - underlaying AA_Stringexpand_Modulefield is cached

{sort} - sorts the values

Syntax

{sort:<values>[:<order-type>[:<unique>[:<delimiter>]]]}

Parameters

@param $ids // parts separated by '-'
@param $limit // number of returned shuffled ids

{striptags} Strip all tags

Strips all HTML and PHP tags from the 'string'
Syntax:

{striptags:string}

See striptags() function in PHP.

{str_replace} Replacing substrings

Acts like the PHP function str_replace, the arguments are : search for what, replace with what, search where
Syntax:

{str_replace:find:replace_with:search}

Usage

{str_replace:uno:one:text with uno inside}
{str_replace:["�","�","�"]:["c","s","r"]:text �esky with accents}
when replacing by empty values:
{str_replace:[";-)",";-("]:["",""]:we do not like smiles ;-(}

Parameters

$search
$replace
$text

{substr} Dividing strings

Performs a substring on the given 'string', starting at position 'start', with the 'length' specified
Syntax:

{substr:string:start:length}

length defaults to (109 -1)
!beware that the first character of the string is actually the 0th

Usage

{substr:{headline........}:0:60:...}

{switch} - Comparing Values

Switch extends the functionality conditional expressions, otherwise managed f_c function. Switch provides more flexibility through giving more options, regular expressions, etc. Switch takes it's logic from the php switch statement, although the syntax is different.

Syntax:

{switch(<expression>)<value1>:<output1>:....:<valueN>:<outputN>[:<default_output>]} 

Parameters

* <expression> - is any valid AA expression (you can/will use {} in there)
* <value1>            - <valueN> is the regular expression  value which the result of the <expression> will be compared with 
* <output1>           - <outputN> is the result of the {switch} expression if the <value1>     matches the result of <expression>
* <default_output>    - is the result if no match is found among <value1> - <valueN> 

Note: Because ':' is used as a separator, if you need to use ':' in either <value> or <output> you must prefix it with a '#' escape character, i.e. "#:"

Example:

{switch({number.........1})1:one:2:two:[3-7]:more:too much}

ActionApps evaluates the <expression>, which is the value of the >number.........1 field in our case. If content of the field is equal to 1, the 'one' is the result and will be printed. Because <values> are regular expressions, we can specify the third option as [3-7] which means any number in range between 2 and 7. The default option is 'too much' in our case. The evaluation process goes through values from left to right, the the first match is taken and no further evaluation is performed.


Another example displays text 'Continuos grant', if the field unspecified....2 is filled by 'yes', 'on', 'true' or '1'. Else it displays expiry date:

{switch({unspecified....2})yes|on|true|1:Continuous grant::12/11/2007}

Display of phone number, if specified (note that '#:' is an escaped ':' to distinquish from the argument separators):

{switch({con_phone......1}).+:Tel#:{con_phone......1}}

.+ (or just . (dot)) means non empty string in regular expressions. If you are not familiar with "regular expressions", please look at any tutorial. Regular expressions are very powerfull and you will find it usefull not only in ActionApps.

Remember, that regular expressions searches for substring, so if you want to compare exact value, there are two possibilities:

{switch({number..........})^14$:exactly fourteen}

^ is begin of the line in regular expressions, $ is end of line

{switch(x{number..........}x)x14x:exactly fourteen}

Used a trick with added two random characters in the expression (since expression could be any AA string)

Last example the flexibility of the <expression>. IT can be any valid ActionApps expression, and the of nesting of curly bracket expressions is unlimited.

{switch({disc_count......})[1-9][0-9]*:There is discussion under this item}

{table} - experimental - do not use - will be probably replaced with Array

(nevercached - because it caches also "set" and "addset" commands, so ignores the second same "set"/"addset" command )

{tagcloud} - Creates tag cloud from the items

Syntax

{tagcloud:<item_ids>[:<count>[:<alias>[:<count_field>]]]}

Parameters

<item_ids>     - dash separated list of ids of all keywords (tags)
<count>        - maximum number of displayed keywords (all by default)
<alias>        - The AA expression used for each keyword (_#HEADLINK used as default)
<count_field>  - The id of the field, where you already have the number of ussage precounted. It is very good idea,to have such  field - in other case the counts must be countedon every ussage. The count could be counted automaticaly in the field by using  "Comuted field for INSERT/UPDATE" with the parameter "_#BACKLINK:_#BACKLINK::day", where alias _#BACKLINK could be definned as  {count:{backlinks:{id..............}::-}}

or say

{count:{ids:1450a615da76cae02493aac79e129da9:d-relation........-=-{id..............}}}

Usage

{tagcloud:{ids:02e34dc7f9da6473fc84ad662dfe53a}}
{tagcloud:{ids:02e34dc7f9da6473fc84ad662dfe53a}:20}
{tagcloud:{ids:02e34dc7f9da6473fc84ad662dfe53a::headline........}::_#HEADLINK}
{tagcloud:{ids:02e34dc7f9da6473fc84ad662dfe53a::headline........}::headline........:computed_num....}

The resulting HTML code is like:

  • Curso
  • Palabra
  • Poetry

The links are marked in its class by the importance (number of use) so you can set style them. There are 8 classes tagcloud1 - tagcloud8. The styles could by:

<style type="text/css">

ul.tagcloud li.tagcloud1 { font-size: 1.8em; font-weight: 800; }

ul.tagcloud li.tagcloud2 { font-size: 1.6em; font-weight: 700; }

ul.tagcloud li.tagcloud3 { font-size: 1.4em; font-weight: 600; }

ul.tagcloud li.tagcloud4 { font-size: 1.2em; font-weight: 500; }

ul.tagcloud li.tagcloud5 { font-size: 1.0em; font-weight: 400; }

ul.tagcloud li.tagcloud6 { font-size: 0.9em; font-weight: 300; }

ul.tagcloud li.tagcloud7 { font-size: 0.8em; font-weight: 200; }

ul.tagcloud li.tagcloud8 { font-size: 0.7em; font-weight: 100; }

ul.tagcloud { padding: 2px; line-height: 3em; text-align: center; margin: 0; }

ul.tagcloud li { display: inline; padding: 0px; }

</style>

{timestamp} - return current timestamp based on the textual date provided

Syntax

{date:<format>:<timestamp>}

Usage

{timestamp:2008-07-01}
{timestamp:20080701t223807}
{timestamp:next Monday}


{tree} - returns long ids of subitems items based on the relations between items

Syntax

{tree:<item_id>[:<relation_field>]}

Usage

{tree:2a4352366262227383484784635362ab:relation.......1}

Parameters

@param $item_id         - item id of the tree root (short or long)
@param $relation_field  - tree relation field (default relation........)

return dash separated long ids of items which belongs to the tree under specifield item based on the relation field

{treecache} - helper class for AA_Stringexpand_Item

{treestring}

Return string representation of the tree (with long ids) under specifield item based on the relation field

Syntax

{treestring:<item_id>[:<relation_field>[:<reverse>[:<sort>]]]}.

Where

  • <reverse> creates the tree for child->parent relations
  • <sort> the order of leaves (currently wors only for reverse trees)

Usage

{treestring:2a4352366262227383484784635362ab:relation.......1}
{treestring:2a4352366262227383484784635362ab:relation.......1:1}
{treestring:2a4352366262227383484784635362ab:relation.......1:1:sort[0][headline........]=a&sort[1][publish_date....]=d}
{treestring:2a4352366262227383484784635362ab:relation.......1:1:headline........:35615a6d5fdfeb23d36d1c94be3cd9b4}

Parameters

@param $item_id         - item id of the tree root (short or long)
@param $relation_field  - tree relation field (default relation........)
@param $reverse         - 1 for reverse trees (= child->parent relations)
@param $sort_string     - order of tree leaves (currently works only for reverse trees. @todo)

{trim} - trims whitespaces form begin and end of the string

Syntax

{trim:<string>}

Removes beginning and ending spaces from the <string> - see php trim() function


{unalias_Callback} - helper class

Its purpose is just tricky - we can't use preg_replace_callback where callback function has some more parameters. So we use this class as callback

Parameters

@param $item
@param $itemview

{unique} - removes duplicate ids form the string

Syntax

{unique:<ids>[:<delimiter>]}

Parameters

for offset and length parameters see PHP function array_slice()
@param $ids         - item ids (or any other values) separated by '-'
@param $delimiter   - separator of the parts - by default it is '-', but you can use any one

{urlencode} Provide a 'safe' URL

Encodes the 'URL', so that there are no alphanumeric characters except the underscore (_)
Example:

{urlencode:http#://www.no-commerci.al}

Note the escape character (#) usage, so that the other part of the 'URL' doesn't seem like a second parameter to the directive

{user} - Reading Logged In User Values

In AA v2.6 is new Reader Management, where you can control access to directory or file through AA admin interface (see Reader Management). You can then display informations about logged in user by {user:} construct.

The syntax:

{user:<keyword or field ID>}

where <keyword or field ID> are explained on examples below:

{user:} displays login of current user
(this option do not search in database, so it is quick)
You can use this parameter even if you do not use Reader Management slice and you are using standard Apache's password file auth ...
{user:password} displays password of current user (in plain text)
(this option also do not looks into database, but into internal server variable, so it is also quick)
{user:headline........}

displays headline........ field for current user, which is grabbed from Reader Management slice. There is no need to specify in which Reader Management slice user is, because all users are unique in all Reader Management slices.
If the Reader Management slice is protected by password (see 'Slice Admin' -> 'Slice' -> 'Password for Reading'), you have to add slice_pwd parameter to view.php3 (or slice.php3), in which you want to display user's database info.
You can of course display any field from Reader Management slice.

{user:role} displays user's permission role (author/editor/administrator/super/undefined)
(usefull in AA admin interface when you want to display another informations to authors and editors - use it in switch() - like {switch({user:role})editor:_#POSTED_BY} )

Such construct you can use in any view or slice - just like any other aliases.

Parameters

$field

{userinfo}

Returns name or other info about user (usable for posted_by, edited_by, ...)

Syntax

{userinfo:<user>[:<property>]}

Parameters

@param $user      - user as stored in posted_by....... or edited_by....... field
@param $property  - 'name' at this moment only, which is default

{var} - prints defined named expression

Syntax

{var:name:param1:param2:...:...}

Usage

{var:username:Joseph}

Parameters

@see AA_Stringexpand_Define for more info
@param $parameters - field id and other modifiers to the field

You can use it for

  • creating on-line "aliases",
  • passing parameters between nested views,
  • ...

{<variable>} - Reading a Value of a Variable

Syntax:

{<variable>}

where variable must be a name of an existing variable defined in site module (apc_state) or through als[variable] the url parameter.

Example: Say you have defined the alias through the

...view.php3?vid=123&als[heading]=My Page

then use

<h1>{heading}</h1>

If the variable doesn't exist, the result is an empty string.


{view} - Including Views

You can include the output of any ActionApps view into any design template. Most of the time you will be using this to include your views in the site module. But you can also can include a view within another view, include the output of a certain view as a parameter for any function etc. Put simply, use anywhere in ActionApps where {} syntax is valid. This a powerful function (with a really bad name).

Syntax:

{view.php3?vid=<View ID>[&parameter1&parameter2&...]}

Where <View ID> must be a valid view ID. You can pass URL parameters to the view as if you were calling it via URL, but they can also be expressions enclosed in {}, which will evaluate first.

Example 1:

{view.php3?vid=123}

Returns content of view 123.

Example 2:

{view.php3?vid=122&cmd[122]=c-1-{f}}  

f is a variable, a value of which will be passed to the 1st condition of the view 122

Example 3:

{view.php3?vid=33&cmd[33]=x-33-{relation.......1}} 

use this for displaying related items

Parameters

$vid
$ids

{xid} - Id of the current item on specified level of page tree (in Site module AA_Router_SEO)

 {xid[:<level>]}

Complement to {xseo1},.. variables of AA_Router_Seo

 {xid}

Returns id of current item (the id of {xseo} item)

 {xid:1}

Returns id of item on first level (the id of {xseo1} item) for /cz/project/about-us returns id of "project" item

 {xid:path} 

Returns ids path of current item - like 2587(2877(3004)) as used in {item...} syntax. Good for breadcrumbs:

 {item:{xid:path}: _#HEADLINE:: _#HEADLINK >}


{xpath}

Syntax

{xpath:<XML/HTML string>:<xpath>[:<attribute>[:<delimiter>]]}


Usage

{xpath:{include:http#://example.cz/list.html}://[@id="pict-width"]}
{xpath:{include:http#://example.cz/photos/displayimage.php?pos=-47}:/html/body//div[@id="picinfo"]//td[text()="Datum"]/following-sibling#:#:*}
{xpath:{include:http#://example.cz/list.html}://img[@id="bigpict"]:width}
{xpath:{include:http#://example.cz/list.html}://h2[2]} - second


Parameters

@param $string        - XML or HTML string (possibly loaded with {include:<url>})
@param $query         - XPath query - @see XPath documentation
@param $attr          - if empty, the <text> value of the matching element is returned if specified, then the attribute is returned
@param $delimiter     - by default, it returns just first matching value. If specified, then all matching texts are returned delimited by <delimiter>returns part of the XML or HTML <string > based on <xpath> query

Returns part of the XML or HTML <string > based on <xpath> query

{xuser}

Expands {xuser:xxxxxx} alias - auth user informations (of current user)

Syntax

{xuser:xxxxxx}

Parameters

@param $field - field to show ('headline........', '_#SURNAME_' ...) 
empty         - for username (of curent logged user) 
id            - for long id

We do not use {user} in this case, since views with {user} are not cached, but the views with {xuser} could be (xuser is part of apc variable)

{yahoo} Connecting to a user

  • The same as the previous instant messaging directives
  • The output is similar to {skype} as it does not link to an external website, just places the ymsgr: part into the URL of the link

Syntax:

{yahoo:<yahoo_name>[:<action>[:<style>]]}

Parameters:

user_id    - yahoo name of the user
action     - addfriend | call | sendim
style      - 0-4 - dysplayed icon type

Example:

{yahoo:my_name:addfriend:1}