如何在cakephp 1.3中包含javascript? [英] How to include javascript in cakephp 1.3?

查看:221
本文介绍了如何在cakephp 1.3中包含javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这个简单的问题让我很疯狂..

  http://www.mediafire.com/?2vi2kc7tpqiw1to 

这是幻灯片代码包含CSS,HTML,jQuery代码。



这张幻灯片工作正常,但是当我在cakephp不是
工作。



我把jQuery文件和CSS放在webroot,并把代码包括在
layout / default.ctp like this

  echo $ javascript-> link('jcookie.js'); 
echo $ javascript-> link('jquery-1.3.2.min.js');
echo $ javascript-> link('jcarousellite.js');
echo $ javascript-> link('jquery-1.js');

但仍没有任何反应..请任何人帮助我...下载幻灯片并尝试点击

解决方案

a)你shouldnt使用$ javascript了。它将是$ this-> Javascript



b)javascript本身已弃用(参见文档)



使用

  $ this-> Html-> script()
pre>

详情:
http ://book.cakephp.org/view/1589/script


Wait moment this question not duplicated..it is sample and difficult at the same time.

This simple problem make me crazy..

http://www.mediafire.com/?2vi2kc7tpqiw1to

This is slide code contain CSS, HTML, jQuery code.

This slide works fine, but when I include this slide in cakephp it is not working.

I put jQuery files and CSS in webroot and put the code to include in layout/default.ctp like this

echo $javascript->link('jcookie.js');
echo $javascript->link('jquery-1.3.2.min.js');
echo $javascript->link('jcarousellite.js');
echo $javascript->link('jquery-1.js');

but still nothing happen ..please anyone help me..download the slide and try to click on the top to slideshow pictures..and then include it in cake..you will find the problem..

解决方案

a) you shouldnt use $javascript anymore. it would be $this->Javascript

b) javascript itself is deprecated (see the documentation)

so use

$this->Html->script()

details: http://book.cakephp.org/view/1589/script

这篇关于如何在cakephp 1.3中包含javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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