Delay functions enable to specify the page title, navigation chain items, CSS, control toolbar buttons, meta tags etc. by calling functions within the page body and emit the return values of these functions in the prologue, that is, place these values in the code generated earlier.
This technology has been developed mainly for use in components, which are usually placed in the page body but may want to set the page title, add items to navigation chain, add buttons to the control toolbar etc.
Note
The delay functions technology is used in the public
section only. It is not intended for use in the administrative
section.
This technology works by the following algorithm.
The stack B stores names and parameters of the delay functions, in the order they appear in the code.
Therefore, this technology enables to fragment the page content splitting it into sections using functions that allow delaying execution of other functions. At the end of the page, all delay functions are executed consequently and their results are inserted in spots previously allocated in the fragmented page content. Then, all the fragmented content is merged, sent to the output stream and dispatched to a client's browser.
Consideration must be given to the fact that no operation may be performed on results of the functions that may cause other functions to be delayed. For example:
$page_title = $APPLICATION->ShowTitle(); // returns nothing
if (strlen($page_title)<=0)
$page_title = "Default title";
echo
$page_title;
This code is not functional because all delay functions are executed at the end
of the page, in the epilogue service section.
| Name of the delaying function | Delays execution of these functions | Additionally involved functions |
|---|---|---|
| CMain::ShowTitle | CMain::GetTitle | CMain::SetTitle |
| CMain::ShowCSS | CMain::GetCSS |
CMain::SetTemplateCSS CMain::SetAdditionalCSS |
| CMain::ShowNavChain | CMain::GetNavChain | CMain::AddChainItem |
| CMain::ShowProperty | CMain::GetProperty |
CMain::SetPageProperty CMain::SetDirProperty |
| CMain::ShowMeta | CMain::GetMeta |
CMain::SetPageProperty CMain::SetDirProperty |
| CMain::ShowPanel | CMain::GetPanel | CMain::AddPanelButton |
| © 2001-2005 Bitrix | Bitrix Site Manager - Content Management & Portal Solutions |