本文整理汇总了PHP中Component::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Component::render方法的具体用法?PHP Component::render怎么用?PHP Component::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component::render方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderComponent
private function renderComponent(Component $viewComp)
{
if (isset($_GET["ajax"])) {
return StringUtil::getJson("body", $viewComp->renderBodyChildren());
}
$view = $viewComp->render();
if (isset($_GET["file"])) {
$view .= $this->jsRewriteParent();
}
return $view;
}
示例2: renderComponent
/**
* Render the component.
*
* @param string $option The component option.
* @param array $params The component parameters
*
* @return object
*
* @since 11.1
*/
public static function renderComponent($option, $params = array())
{
if (!self::isLegacy()) {
return \Component::render($option, $params);
}
// Initialise variables.
$app = JFactory::getApplication();
// Load template language files.
$template = $app->getTemplate(true)->template;
$lang = JFactory::getLanguage();
$lang->load('tpl_' . $template, JPATH_BASE, null, false, true) || $lang->load('tpl_' . $template, JPATH_THEMES . "/{$template}", null, false, true);
if (empty($option)) {
// Throw 404 if no component
JError::raiseError(404, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'));
return;
}
// Record the scope
$scope = $app->scope;
// Set scope to component name
$app->scope = $option;
// Build the component path.
$option = preg_replace('/[^A-Z0-9_\\.-]/i', '', $option);
$file = substr($option, 4);
// Define component path.
define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option);
define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option);
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option);
// Get component path
if ($app->isAdmin() && file_exists(JPATH_COMPONENT . '/admin.' . $file . '.php')) {
JLog::add('Files in the format admin.COMPONENTNAME.php are considered deprecated and will not be loaded in Joomla 3.0.', JLog::WARNING, 'deprecated');
$path = JPATH_COMPONENT . '/admin.' . $file . '.php';
} else {
$path = JPATH_COMPONENT . '/' . $file . '.php';
}
// [!] HUBZERO - Set path and constants for combined components
$client = $app->isAdmin() ? 'admin' : 'site';
// Get component path
if (is_dir(JPATH_SITE . '/components/' . $option . '/' . $client)) {
define('JPATH_COMPONENT', JPATH_SITE . '/components/' . $option . '/' . $client);
define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option . '/site');
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_SITE . '/components/' . $option . '/admin');
} else {
define('JPATH_COMPONENT', JPATH_BASE . '/components/' . $option);
define('JPATH_COMPONENT_SITE', JPATH_SITE . '/components/' . $option);
define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR . '/components/' . $option);
}
$path = JPATH_COMPONENT . '/' . $file . '.php';
// [!] HUBZERO - END Set path and constants for combined components
// If component is disabled throw error
if (!self::isEnabled($option) || !file_exists($path)) {
JError::raiseError(404, JText::_('JLIB_APPLICATION_ERROR_COMPONENT_NOT_FOUND'));
}
$task = JRequest::getString('task');
// Load common and local language files.
$lang->load($option, JPATH_BASE, null, false, true) || $lang->load($option, JPATH_COMPONENT, null, false, true);
// Handle template preview outlining.
$contents = null;
// Execute the component.
$contents = self::executeComponent($path);
// Revert the scope
$app->scope = $scope;
return $contents;
}
示例3: renderNow
/**
* Force an update on a specified component
*
* @param Component $c
*
* @return void
*/
public function renderNow(Component $c)
{
ob_start();
$c->render();
$this->response->setUpdate($c->getDivId(), ob_get_clean());
}
示例4: renderChild
protected function renderChild(Component $child)
{
$child->render();
}