本文整理匯總了PHP中Template_Controller::classes方法的典型用法代碼示例。如果您正苦於以下問題:PHP Template_Controller::classes方法的具體用法?PHP Template_Controller::classes怎麽用?PHP Template_Controller::classes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Template_Controller
的用法示例。
在下文中一共展示了Template_Controller::classes方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: load
/**
* Load template data
*
* Loops through each body class for the current template, checks for a method of
* the same name as the class, and calls that method if it exists
*
* @return void
*/
public function load()
{
/**
* Global variable to store template data.
*
* Place the following at the top of your template file as an alternative to calling
* `tpl_data()` or `get_tpl_data()` functions for each individual data key
* `global $template_data;`
* `extract( $template_data, EXTR_SKIP );`
*
* @global array template_data
*/
global $template_data;
// Add `common` to class array so that it loads for every template
self::$classes = get_body_class('common');
foreach (self::$classes as $class) {
$class = str_replace('-', '_', $class);
if (method_exists($this, $class)) {
call_user_func(array($this, $class));
}
}
// Push template data out to global variable
$template_data = array_merge(self::$data, self::$data_replace);
}