如何在Opencart中动态添加JavaScript? [英] How to add JavaScript dynamically in Opencart?

查看:153
本文介绍了如何在Opencart中动态添加JavaScript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在category.tpl中使用jQuery插件.将文件放在javascript/jquery目录中.现在,如何使用此插件?

I want use a jQuery plugin in category.tpl. Put files in javascript/jquery directory. Now, how can use this plugin?

推荐答案

我从没使用过OpenCart,但是一个快速的Google会话告诉我,您应该在名为header.tpl.

I've never used OpenCart, but a quick google session tells me that you should include the plugin scripts (just like any other js) in a file called header.tpl.

这是我发现的示例header.tpl文件的一部分:

Here is a part of an sample header.tpl-file I found:

<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.3.2.min.js"></script>

只需在jQuery include下方添加以下行即可,如下所示:

Just add a the following line below the jQuery include so it looks like this:

<script type="text/javascript" src="catalog/view/javascript/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="catalog/view/javascript/jquery/[PLUGIN FILE NAME].js"></script>

你应该很好.

这篇关于如何在Opencart中动态添加JavaScript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆