What is custom page?"Custom page" feature allows administrator to create and modify new pages for Glossword, in addition to pages "Top 10" and "Feedback". Pages are nested, and they have a tree structure. It means some pages (childs) could be placed under another pages (parents). Beginning from version 1.7.0 Glossword allows to include custom PHP-code with your custom page. Beginning from version 1.8.0 Glossword allows to export and import all custom pages at once. So you can transfer all the site contents with a click. What variables could be used in a custom page?There are some PHP-variables which could be used in PHP-code: - $ar_tpl_construct Array. HTML-template names for visual theme. Each page of visual theme consists several HTML-templates.
- $gw_this Array. Allowed values received from $GET and $POST, the list of dictionaries with their settings.
- $oDb Object. Database class.
- $oFunc Object. Functions class.
- $oL Object. Translation Kit class to access translation files.
- $oSqlQ Object. SQL-storage class to access database queries.
- $oTpl Object. HTML-template class.
- $str_current_section String. Current section name. Also used in HTML-tags
<title> , <meta> . - $sys Array. All Glossword settings.
Where are code examples for custom page? =The following example adds new variable block:dict_updated to HTML-templates with the list of recently updated dictionaries: $oTpl->addVal( 'block:dict_updated',
gw_html_block_small( $oL->m('r_dict_updated'),
getTop10('DICT_UPDATED', $sys['max_dict_top'], 0)
)
);Includes the contents of HTML-file: $arV['page_content'] = $oFunc->file_get_contents('templates/common/gw_info1.html');
$oTpl->addVal( 'block:', $arV['page_content']);- $arV['page_content'] - pre-defined variable.
- $oFunc->file_get_contents() - function to read file contents.
- $oTpl->addVal() - function to add a variable into HTML-templates.
Includes the results of processing PHP-file: chdir('../myproject');
$arV['page_content'] = $oFunc->file_exe_contents('myindex.php');
$oTpl->addVal( 'block:', $arV['page_content']);
chdir('../glossword');- $arV['page_content'] - pre-defined variable.
- $oFunc->file_exe_contents() - function to execute PHP-script and read it's contents.
- $oTpl->addVal() - function to add a variable into HTML-templates.
|