本文整理汇总了PHP中Localization::add_strings_table方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::add_strings_table方法的具体用法?PHP Localization::add_strings_table怎么用?PHP Localization::add_strings_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization::add_strings_table方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render_component
/**
* @short Renders a view from a controller other than self.
* @details This method renders a view from a controller other than self,
* for example when embedding a view into another view.
*
* The <tt>params</tt> array has the same semantics of the <tt>render</tt> method,
* with the following additions:
*
* <tt>controller</tt>: the name of the controller responsible for the view (defaults to self).
* @param params Parameters defining how the rendering should be realized.
*/
public function render_component($params)
{
// Merge request and user parameters
$_GET = array_merge($_GET, $params);
// If a controller is not set, use current controller
if (!isset($params['controller'])) {
$controller_name = $this->name;
} else {
// Use the value stored in params as controller name
$controller_name = basename($params['controller']);
// Include the controller class file
require_once dirname(__FILE__) . '/../controllers/' . $controller_name . '_controller.php';
// Load localization table
Localization::add_strings_table($controller_name);
}
// Create class name
$classname = joined_lower_to_camel_case($controller_name) . 'Controller';
// Instantiate controller
$controller = new $classname();
// Unset controller key from params (why?)
unset($params['controller']);
// Set requested action
if (isset($params['action'])) {
$action = basename($params['action']);
$controller->action = $action;
}
// Invoke action method
$controller->{$action}();
// Request rendering with no layout
$params['layout'] = FALSE;
// Note that this could already have been called
$controller->render($params);
}