Zend Studio/Framework 中的 jQuery 集成问题
我正在努力构建一个可以调用 jQuery 的简单 zend 框架应用程序。 所以,我在 Zend Studio 7.1.1 下工作,我在库文件夹中添加了“ZendX”文件夹。 而且,我还下载了添加到“js”公共文件夹中的 jQuery lightness 主题。
你会发现整个结构是这样的: http://www.freeimagehosting.net/image.php?b95bca6dab.png 所以我所做的是: 1-将以下几行添加到 Bootstrap.php 文件中,以便获得以下内容:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}
Zend_Loader::registerAutoload();
$view= new Zend_View();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$view->jQuery()->addStylesheet('/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css')
->setLocalPath('/js/jquery/js/jquery-1.3.2.min.js')
->setUiLocalPath('/js/jquery/js/jquery-ui-1.7.2.custom.min.js');
然后,由于我不使用布局,所以我直接在 index.phtml
文件中添加了日期选择器$view->jQuery()
和 $view->jQuery()
即使当我输入 $view->
Zend Studio 智能感知系统不建议使用 jQuery()
函数。 无论如何,index.phtml
文件是:
<style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<?php echo $this->headScript(); ?>
<?php echo $this->jQuery()->uiEnable();?>
<?php echo $this->jQuery(); ?>
<form id='ok'>
Pick your Date: <?php echo $this->datePicker('dp1', '', array('defaultDate' => date('Y/m/d', time()))); ?>
</form>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div>
但是没有任何作用!
我得到以下输出:
ttp://www.freeimagehosting.net/uploads/7ed0166140.png
如您所见,日期选择器输入文本位于此处,但单击时,它什么也不显示。
对于源页面(index.phtml):
<style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<link rel="stylesheet" href="../public/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css" type="text/css" media="screen">
<script type="text/javascript" src="../public/js/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../public/js/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<form id='ok'>
Pick your Date: <input type="text" name="dp1" id="dp1" value=""></form>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div>
我确实尝试了很多组合,但没有办法弄清楚! 如果还尝试找到一个视频,逐步准确地展示如何在 Zend 中集成 jQuery。
代码有什么问题吗?
如果您能帮助我,我将非常感激!
非常感谢,
问候。
I'm struggling to build a simple zend framework application that can call jQuery.
So, what I'm working under Zend Studio 7.1.1 where I added, in the library folder, the "ZendX" folder.
And, I also downloaded the jQuery lightness theme that was added to the "js" public folder.
You'll find the whole structure is like that:
http://www.freeimagehosting.net/image.php?b95bca6dab.png
So what I did is:
1- Added the following lines into the Bootstrap.php file so that I obtained the following content:
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}
Zend_Loader::registerAutoload();
$view= new Zend_View();
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
$viewRenderer->setView($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
$view->jQuery()->addStylesheet('/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css')
->setLocalPath('/js/jquery/js/jquery-1.3.2.min.js')
->setUiLocalPath('/js/jquery/js/jquery-ui-1.7.2.custom.min.js');
Then, as I don't use the layouts, I directly added the datepicker in the index.phtml
file with the $view->jQuery()
and $view->jQuery()
even if when I type $view->
the Zend Studio intellisense system doesn't propose the jQuery()
function.
Anyway, the index.phtml
file is:
<style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<?php echo $this->headScript(); ?>
<?php echo $this->jQuery()->uiEnable();?>
<?php echo $this->jQuery(); ?>
<form id='ok'>
Pick your Date: <?php echo $this->datePicker('dp1', '', array('defaultDate' => date('Y/m/d', time()))); ?>
</form>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div>
But nothing works!
I get the following output:
ttp://www.freeimagehosting.net/uploads/7ed0166140.png
As you can see, the datepicker input text is here, but on click, it shows nothing.
And for the source page (index.phtml):
<style>
a:link,
a:visited
{
color: #0398CA;
}
span#zf-name
{
color: #91BE3F;
}
div#welcome
{
color: #FFFFFF;
background-image: url(http://framework.zend.com/images/bkg_header.jpg);
width: 600px;
height: 400px;
border: 2px solid #444444;
overflow: hidden;
text-align: center;
}
div#more-information
{
background-image: url(http://framework.zend.com/images/bkg_body-bottom.gif);
height: 100%;
}
</style>
<div id="welcome">
<h1>Welcome to the <span id="zf-name">Zend Framework!</span></h1>
<h3>This is your project's main page</h3>
<link rel="stylesheet" href="../public/js/jquery/css/ui-lightness/jquery-ui-1.7.2.custom.css" type="text/css" media="screen">
<script type="text/javascript" src="../public/js/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="../public/js/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<form id='ok'>
Pick your Date: <input type="text" name="dp1" id="dp1" value=""></form>
<div id="more-information">
<p><img src="http://framework.zend.com/images/PoweredBy_ZF_4LightBG.png" /></p>
<p>
Helpful Links: <br />
<a href="http://framework.zend.com/">Zend Framework Website</a> |
<a href="http://framework.zend.com/manual/en/">Zend Framework Manual</a>
</p>
</div>
</div>
I really tried many combinaisons, but no way to figure out it!
If also tried to find a video showing exactly, step by step, how to integrate jQuery in Zend.
What's wrong in the code?
If you can help me, I would really appreciate that!
Thanks very much,
regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
jQuery->enable;?>
应该是enable()
并驻留在控制器/引导程序中。如果您想将 jQuery 添加到所有页面,我会更改
为
,否则您根本不需要启用它,因为调用像
datePicker()
这样的帮助器会自动包含 jQuery 和 jQuery UI在您的页面上。<?php $this->jQuery->enable;?>
should beenable()
and reside in the controller/bootstrap.If you'd like to add jQuery to all pages, I would change
to
, otherwise you don't need to enable it at all, since calling a helper like
datePicker()
automatically inclues jQuery and jQuery UI on your page.