žemiau pateikiu UDT norintiems į terpti vieno puslapio turinį į kitą. Gali būti naudinga, kai yra poreikis turėti kelis puslapius su tuo pačiu turiniu. Šiuo atveju užteks redaguoti tik vieną puslapį.
Naudojimas:
- sukurkite UDT vardu include_content;
- įkelkite žemiau pateiktą kodą ir išsaugokite;
- Norimame puslapyje įrašykite {include_content page_alias='ALIASAS_I_PUSLAPI_KURI_NORIT_IKELTI'}.
Code: Select all
# include_content - user defined tag (UDT) for CMS - CMS Made Simple
#This UDT includes a content of another page to the current page.
#It processes smarty tags in content of page to be
#inserted before including.
if( isset( $params['page_alias'] ) )
{
global $gCms;
$smarty = &$gCms->GetSmarty();
$onecontent = ContentManager::LoadContentFromAlias($params['page_alias'], false);
if(isset( $onecontent ) && is_object( $onecontent ))
{
$content=$onecontent->mProperties->mPropertyValues['content_en'];
$smarty->_compile_source('temporary template', $content, $compiled);
@ob_start();
$smarty->_eval('?>' . $compiled);
$content = @ob_get_contents();
@ob_end_clean(); return $content;
}
else return 'include_content: a page with alias "'.$params['page_alias'].'" not found.';
}
else return 'include_content: parameter \'page_alias\' is not set.';

Vilkis