本文整理汇总了PHP中CTemplate::addScript方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::addScript方法的具体用法?PHP CTemplate::addScript怎么用?PHP CTemplate::addScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTemplate
的用法示例。
在下文中一共展示了CTemplate::addScript方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showToolbar
function showToolbar($data = null)
{
$mySQLVer = 0;
if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) {
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php';
$mySQLVer = CAdvanceSearch::getMySQLVersion();
}
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php';
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php';
$format = JRequest::getVar('format', 'html', 'get');
if ($format == 'json') {
return;
}
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$my = CFactory::getUser();
$userid = JRequest::getInt('userid', '');
$user = CFactory::getUser($userid);
// Get the configuration object.
$config = CFactory::getConfig();
//JHTML::_('behavior.tooltip');
$js = 'assets/window-1.0';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = 'assets/script-1.2';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = '<script type=\'text/javascript\'>';
$js .= '/*<![CDATA[*/';
$js .= 'var js_viewerId = ' . $my->id . '; ';
$js .= 'var js_profileId = ' . $user->id . ';';
$js .= '/*]]>*/';
$js .= '</script>';
$mainframe->addCustomHeadTag($js);
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded
// if(JRequest::getVar('screen')=='mobile')
// {
// $document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' );
// }
// This need to be loaded in main messaging library
CFactory::load('libraries', 'window');
CWindow::load();
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$mainframe->addCustomHeadTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
$task = JRequest::getVar('task', '', 'GET');
$groupId = JRequest::getInt('groupid', '', 'GET');
// Hide the toolbar from unregistered user
// but still show the mini header
if (empty($my->id)) {
if (!empty($groupId) && $task != 'viewgroup') {
CFactory::load('libraries', 'miniheader');
echo CMiniHeader::showGroupMiniHeader($groupId);
return;
}
echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser);
return;
}
/**
* Inbox unread count
*/
$inboxUnread = 0;
if (!empty($data['inbox'])) {
$inboxUnread = $data['inbox'];
}
/**
* Notification alert
*/
$notiAlert = 0;
$notiAlert = $this->_newNotification();
if (!empty($notiAlert) && $notiAlert > 0) {
CFactory::load('libraries', 'window');
CWindow::load();
}
$config = CFactory::getConfig();
$logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false);
$logoutLink = base64_encode($logoutLink);
$isFacebookUser = false;
if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) {
CFactory::load('libraries', 'facebook');
CFactory::load('models', 'connect');
// Once they reach here, we assume that they are already logged into facebook.
//.........这里部分代码省略.........
示例2: executeMobile
public function executeMobile($task = '')
{
CFactory::load('libraries', 'mobile');
$view =& $this->getView(JRequest::getCmd('view', 'frontpage'));
// Fetch content
ob_start();
if (!empty($task) && method_exists($this, $task)) {
$this->{$task}();
} else {
$this->display();
}
$content = ob_get_contents();
ob_end_clean();
// Swap joomla document with
// CDocumentMobile or CDocumentMobileAjax
$document =& JFactory::getDocument();
if (JRequest::getCmd('section') == 'content') {
$document = new CDocumentMobileAjax($document);
echo $content;
} else {
$document = new CDocumentMobile($document);
// Add our scripts & stylesheets
CTemplate::addScript('script.mobile-1.0');
CTemplate::addScript('joms.ajax');
CTemplate::addStylesheet('style.mobile');
// Fetch toolbar
ob_start();
$view->showToolbarMobile();
$toolbar = ob_get_contents();
ob_end_clean();
// Fetch switcher
ob_start();
CMobile::showSwitcher();
$switcher = ob_get_contents();
ob_end_clean();
$tmpl = new CTemplate();
$tmpl->set('toolbar', $toolbar);
$tmpl->set('content', $content);
$tmpl->set('switcher', $switcher);
echo $tmpl->fetch('mobile.index');
}
}
示例3: attachHeaders
/**
* Attach necessary scripts and stylesheets for the toolbar to operate correctly on 3rd party
* environments.
**/
private function attachHeaders()
{
$document =& JFactory::getDocument();
$config = CFactory::getConfig();
if ($document->getType() != 'html') {
return;
}
$js = 'assets/window-1.0';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
$js = 'assets/script-1.2';
$js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js';
CAssets::attach($js, 'js');
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// This need to be loaded so the popups will work correctly in notification window
CFactory::load('libraries', 'window');
CWindow::load();
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$document->addCustomTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
}
示例4: attachHeaders
public function attachHeaders()
{
$document = JFactory::getDocument();
$config = CFactory::getConfig();
$my = CFactory::getUser();
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
if ($document->getType() != 'html') {
return;
}
$document = JFactory::getDocument();
$js = '<script type=\'text/javascript\'>';
$js .= '/*<![CDATA[*/';
$js .= 'var js_viewerId = ' . $my->id . '; ';
$js .= 'var js_profileId = ' . $user->id . ';';
$js .= '/*]]>*/';
$js .= '</script>';
$document->addCustomTag($js);
// This need to be loaded so the popups will work correctly in notification window
CFactory::load('libraries', 'window');
CWindow::load();
CFactory::load('libraries', 'minitip');
CMinitip::load();
CFactory::load('libraries', 'template');
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
$template = new CTemplateHelper();
$styleIE7 = $template->getTemplateAsset('styleIE7', 'css');
$styleIE6 = $template->getTemplateAsset('styleIE6', 'css');
$css = '<!-- Jom Social -->
<!--[if IE 7.0]>
<link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" />
<![endif]-->
<!--[if lte IE 6]>
<link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" />
<![endif]-->';
$document->addCustomTag($css);
$css = 'assets/autocomplete.css';
CAssets::attach($css, 'css');
// Required, but added in default template
//$css = 'assets/tipsy-0.1.7/src/stylesheets/tipsy.css';
//CAssets::attach($css, 'css');
// Load joms.ajax
CTemplate::addScript('joms.ajax');
}