gpt4 book ai didi

php - 如何在 joomla 组件中包含 css 和 jquery

转载 作者:行者123 更新时间:2023-12-01 07:14:17 25 4
gpt4 key购买 nike

我将一些jquery和css添加到joomla组件文件view/edit/tmpl/default.php中。我知道我需要使用 jdoc include,但是这样做的步骤是什么?我应该把它放在哪里jdoc:包括?

代码是这样的。

<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

$row = $this->row;
?>

<div class="componentheading" style="margin-bottom:10px;">Edit Event</div>

<form id="form" method="post" action="index.php?option=com_event&view=save" >

<table >
<tr>
<td>Title</td>
<td><input type="text" name="title" value="<?php echo $row->title;?>"></td>
</tr>

<tr>
<td>Start Time</td>
<td><input type="text" name="from" value="<?php echo $row->from;?>" id="datetimepicker"></td>
</tr>
</form>

需要包含的文件

-jquery.datetimepicker.css
-jquery.datetimepicker.js
-jquery.js

最佳答案

你能试试这个吗

 $document =& JFactory::getDocument();
$document->addStyleSheet('your css url here ');// for css
$document->addScript('your jaavscript url here ');// for script

引用号:http://docs.joomla.org/J3.2:Adding_JavaScript_and_CSS_to_the_page

关于php - 如何在 joomla 组件中包含 css 和 jquery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20898408/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com