我想在head中添加css和js文件。但我的模板使用的是龙门架。所以我需要使用龙门式对象来添加css和js。但是这个对象在我的自定义窗体代码中是不可访问的。我想我的requireonce函数不能包含这个文件。
require_once('../../../../templates/rt_graffito/lib/gantry/gantry.php');
$gantry->init();
$gantry->addStyle('media/moo_rainbow/css/mooRainbow.css', 5);
$gantry->addScript('media/moo_rainbow/js/mooRainbow.js');这是我在计时表单中使用的代码。但它不起作用。
发布于 2013-01-19 20:51:19
我敢打赌,你可以使用核心Joomla document对象和机架将它拿起,尝试如下:
<?php
// ... some code here
$document = &JFactory::getDocument();
$document->addScript('media/moo_rainbow/js/mooRainbow.js');
$document->addStyleSheet( 'media/moo_rainbow/css/mooRainbow.css');
// ... other code和文档参考
http://docs.joomla.org/JDocument/addStyleSheet
http://docs.joomla.org/Adding_JavaScript
https://stackoverflow.com/questions/14414400
复制相似问题