本文整理汇总了PHP中JHtml::Script方法的典型用法代码示例。如果您正苦于以下问题:PHP JHtml::Script方法的具体用法?PHP JHtml::Script怎么用?PHP JHtml::Script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JHtml
的用法示例。
在下文中一共展示了JHtml::Script方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a JError object.
*
* @see fetch()
* @since 11.1
*/
public function display($tpl = null)
{
// Request variables
$prodhelperobj = new producthelper();
$this->redTemplate = new Redtemplate();
$this->redHelper = new redhelper();
$this->textHelper = new text_library();
$this->app = JFactory::getApplication();
$this->input = $this->app->input;
$this->model = $this->getModel('product');
$this->document = JFactory::getDocument();
$this->session = JFactory::getSession();
$pageheadingtag = '';
$params = $this->app->getParams('com_redshop');
$menu_meta_keywords = $params->get('menu-meta_keywords');
$menu_meta_description = $params->get('menu-meta_description');
$menu_robots = $params->get('robots');
$this->data = $this->get('data');
$productTemplate = null;
$this->itemId = $this->input->getInt('Itemid', null);
$this->pid = $this->input->getInt('pid', 0);
$layout = $this->input->getString('layout', 'default');
$template = $this->input->getString('r_template', '');
JPluginHelper::importPlugin('redshop_product');
$this->dispatcher = JDispatcher::getInstance();
if (!$this->pid) {
$this->pid = $params->get('productid');
}
/*
* Include JavaScript.
* But, first check if a plugin wants to use its own jQuery.
*/
$stopJQuery = $this->dispatcher->trigger('stopProductRedshopJQuery', array($this->data, $layout));
if (in_array(true, $stopJQuery, true)) {
$stopJQuery = true;
} else {
$stopJQuery = false;
}
if (!$stopJQuery) {
JHtml::Script('jquery.js', 'components/com_redshop/assets/js/', false);
}
JHtml::Script('redBOX.js', 'components/com_redshop/assets/js/', false);
JHtml::Script('json.js', 'components/com_redshop/assets/js/', false);
JHtml::Script('attribute.js', 'components/com_redshop/assets/js/', false);
JHtml::Script('common.js', 'components/com_redshop/assets/js/', false);
// Lightbox Javascript
JHtml::Stylesheet('style.css', 'components/com_redshop/assets/css/');
JHtml::Stylesheet('scrollable-navig.css', 'components/com_redshop/assets/css/');
if ($layout == "downloadproduct") {
$this->setLayout('downloadproduct');
} elseif ($layout == "compare") {
$this->setLayout('compare');
} elseif ($layout == "viewajaxdetail") {
$this->setLayout('viewajaxdetail');
} elseif ($layout == "searchletter") {
$this->setLayout('searchletter');
} else {
// Ajax box
if ($template == 'cartbox' && AJAX_CART_BOX == 1) {
$this->loadTemplate('cartbox');
exit;
} else {
$this->setLayout('default');
}
$prodhelperobj_array_main = $prodhelperobj->getProductNetPrice($this->data->product_id);
if ($this->data->published == 0) {
JError::raiseError(404, sprintf(JText::_('COM_REDSHOP_PRODUCT_IS_NOT_PUBLISHED'), $this->data->product_name, $this->data->product_number));
}
if ($this->data->canonical_url != "") {
$main_url = JURI::root() . $this->data->canonical_url;
$canonical = '<link rel="canonical" href="' . $main_url . '" />';
$this->document->addCustomTag($canonical);
} elseif ($this->data->product_parent_id != 0 && $this->data->product_parent_id != "") {
$product_parent_data = $prodhelperobj->getProductById($this->data->product_parent_id);
if ($product_parent_data->canonical_url != "") {
$main_url = JURI::root() . $product_parent_data->canonical_url;
$canonical = '<link rel="canonical" href="' . $main_url . '" />';
$this->document->addCustomTag($canonical);
} else {
$main_url = substr_replace(JURI::root(), "", -1);
$main_url .= JRoute::_('index.php?option=com_redshop&view=product&layout=detail&Itemid=' . $this->itemId . '&pid=' . $this->data->product_parent_id, false);
$canonical = '<link rel="canonical" href="' . $main_url . '" />';
$this->document->addCustomTag($canonical);
}
}
$productTemplate = $this->model->getProductTemplate();
/*
* Process the prepare Product plugins
*/
$this->dispatcher->trigger('onPrepareProduct', array(&$productTemplate->template_desc, &$params, $this->data));
//.........这里部分代码省略.........
示例2: defined
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
JHtml::_('behavior.tooltip');
JHtmlBehavior::modal();
$uname = '';
$uemail = '';
$address = '';
$telephone = '';
$user = JFactory::getUser();
if ($user->id) {
$uname = $user->name;
$uemail = $user->email;
}
$category_id = $this->input->getInt('category_id', null);
JHtml::Script('jquery.tools.min.js', 'components/com_redshop/assets/js/', false);
$template = $this->redTemplate->getTemplate('ask_question_template');
if (count($template) > 0 && $template[0]->template_desc != "") {
$template_desc = $template[0]->template_desc;
} else {
$template_desc = '<table border="0"><tbody><tr><td>{user_name_lbl}</td><td>{user_name}</td></tr><tr><td>{user_email_lbl}</td><td>{user_email}</td></tr><tr><td>{user_question_lbl}</td><td>{user_question}</td></tr><tr><td></td><td>{send_button}</td></tr></tbody></table>';
}
?>
<script type="text/javascript" language="javascript">var J = jQuery.noConflict();</script>
<script type="text/javascript" language="javascript">
function validateQuestion() {
var frm = document.frmaskquestion;
if (frm.your_name.value == '') {
alert("<?php
echo JText::_('COM_REDSHOP_PLEASE_ENTER_YOUR_NAME');