ezwebin operators
The extension ezwebin (the website interface design) registers six operators in
extension/ezwebin/autoloads/eztemplateautoload.php, one class per file in extension/ezwebin/autoloads/. They exist
only while ezwebin is an active extension. ezpagedata_set and ezpagedata_append store their values through
ezjscore (ezjscPackerTemplateFunctions::setPersistentArray()), so ezwebin needs ezjscore.
| Operator | Class |
|---|---|
ezpagedata, ezpagedata_set, ezpagedata_append | eZPageData (ezpagedata.php) |
ezarchive | eZArchive (ezarchive.php) |
ezkeywordlist | eZKeywordList (ezkeywordlist.php) |
eztagcloud | eZTagCloud (eztagcloud.php) |
Contents
- The operators: ezpagedata_set, ezpagedata_append, ezpagedata, ezarchive, ezkeywordlist, eztagcloud
- Security notes
The operators
ezpagedata_set
| Parameter | Type | Required | Default |
|---|---|---|---|
key | string | yes | false |
value | mixed | yes | false |
- Input: none. Returns: nothing (no output).
Stores value under key in the persistent variable, replacing what was there. In a view template that is
$persistent_variable; in the pagelayout $module_result.content_info.persistent_variable. Because the persistent
variable is saved with the view cache, a value set in a cached view template still reaches the pagelayout on a cached
page.
ezpagedata_append
The same parameters. Appends value to the list under key (a single value becomes a list).
ezpagedata
| Parameter | Type | Required | Default |
|---|---|---|---|
params | array (hash) | no | empty |
- Input: none.
- Returns: a hash of page settings for the pagelayout:
persistent_variable,main_node_id,show_path,website_toolbar,node_id,is_edit,page_root_depth,page_depth,root_node,canonical_url,canonical_language_url,template_look,class_identifier,top_menu,left_menu,current_menu,extra_menu,extra_menu_node_id,extra_menu_subitems,extra_menu_class_list,path_array,path_id_array,path_normalizedandcss_classes.
It reads $module_result (path, content_info, node_id), $ui_context, $uri_string and $current_user from the
template, menu.ini ([SelectedMenu], [MenuSettings] HideLeftMenuClasses[] and AlwaysAvailable,
[MenuContentSettings] ExtraIdentifierList[] and ExtraMenuSubitemsCheck), content.ini [NodeSettings] RootNode
and site.ini [SiteSettings] RootNodeDepth. The values of params and of the persistent variable override the
computed ones (left_menu, extra_menu, top_menu, show_path, website_toolbar, current_node_id with
set_current_node_path, canonical_url, template_look, extra_menu_node_id, extra_menu_class_list,
extra_menu_subitems). That is how a view template hides the left menu of its page: ezpagedata_set( 'left_menu', false() ). Unless template_look is given, it fetches the first object of the class template_look, which is one
query per call.
def $persistent_variable = hash()ezpagedata_set( 'left_menu', false() )ezpagedata_append( 'body_classes', 'recipes' )ezpagedata_append( 'body_classes', 'dark' )
set: $persistent_variable.left_menu|choose( 'false', 'true' ), appended: $persistent_variable.body_classes|implode( ' ' )
def $page = ezpagedata()
keys: foreach $page as $k => $v$kdelimiter /delimiter/foreach
left_menu=$page.left_menu|choose( 'false', 'true' ) css_classes=$page.css_classes top_menu=$page.top_menu root_node=$page.root_nodeOutput:
set: false, appended: recipes dark
keys: persistent_variable main_node_id show_path website_toolbar node_id is_edit page_root_depth page_depth root_node canonical_url canonical_language_url template_look class_identifier top_menu left_menu current_menu extra_menu extra_menu_node_id extra_menu_subitems extra_menu_class_list path_array path_id_array path_normalized css_classes
left_menu=false css_classes=nosidemenu noextrainfo top_menu=flat_top root_node=89ezarchive
| Parameter | Type | Required | Default |
|---|---|---|---|
class_identifier | string | yes | empty |
parent_node_id | integer | yes | 0 |
- Input: none.
- Returns: a list of rows with
month,yearandtimestamp(the first of the month), newest first: the months in which visible children ofparent_node_idof that class have apublication_dateattribute value.
The attribute identifier publication_date is fixed in the SQL. The operator has SQL for MySQL, PostgreSQL and
Oracle only; on any other engine the query is empty and the result is an empty list. The development installation used here runs SQLite, so:
database: ezini( 'DatabaseSettings', 'DatabaseImplementation' )
def $months = ezarchive( 'blog_post', 2 )
ezarchive rows: $months|countOutput:
database: sqlite3
ezarchive rows: 0ezkeywordlist
| Parameter | Type | Required | Default |
|---|---|---|---|
class_identifier | mixed (identifier or list) | yes | empty |
parent_node_id | integer | yes | 0 |
depth | integer | no | 0 (any depth) |
- Input: none.
- Returns: a list of rows with
keyword, the distinct keywords ofezkeywordattributes below the parent node (the parent itself excluded), sorted, filtered by class (an empty identifier means all classes), by depth when given, by the current language, by visibility and by the user's read permissions.
eztagcloud
| Parameter | Type | Required | Default |
|---|---|---|---|
params | array (hash) | no | empty |
- Input: none.
- params:
class_identifier,parent_node_id,limit,offset,sort_by(array( 'keyword' or 'count', ascending )or a list of them; default keyword ascending),post_sort_by(keyword,keyword_reverse,count,count_reverse: sorts after the limit). - Returns: HTML: the template
design:tagcloud/tagcloud.tplrendered with$tag_cloud, a list oftag,countandfont_size(100 to 200, spread over the counts).
Alpha tags its content with eztags, not with ezkeyword attributes, so both keyword operators find nothing here:
def $words = ezkeywordlist( '', 2 )
ezkeywordlist: $words|count keywords, first: foreach $words as $w max 5$w.keyword|washdelimiter, /delimiter/foreach
eztagcloud:
eztagcloud( hash( 'parent_node_id', 2, 'sort_by', array( 'count', false() ), 'limit', 4 ) )Output:
ezkeywordlist: 0 keywords, first:
eztagcloud:For the eztags equivalent see eztagscloud in eztags and star rating operators.
Security notes
ezarchiveputsclass_identifierinto the MySQL and PostgreSQL queries without escaping (only the Oracle query escapes it). Pass a constant identifier, never request input.ezarchiveapplies no permission check: it can list months of content the user may not read.eztagcloudputs the class id and the parent's path string into its SQL; both come from the database, not from the caller.
Related pages
- The persistent variable
- ezjscore operators in depth
- Module result and content info
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.