本文整理匯總了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();
}