泽德 + jquery根本不起作用?
我试图在我的 zend 项目中包含 jquery 助手,zend 的文档有点含糊,它指示在 bootstrap 中使用几行代码,但有很多函数,例如 _initDoctype
/ < code>_initView / _initViewHelpers
/ _initAutoload
但它没有说明我必须将提供的代码粘贴到哪里。我将其粘贴到 _initDoctype
中,这样就足够了吗???
到目前为止,使用这行代码是可以的:
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
当为 js 文件或简单的 css 文件添加这一行时,应用程序崩溃得很严重:
$view->jQuery()->setLocalPath($view->baseUrl . '/js/jquery-1.6.4.min.js');
$view->jQuery()->addStylesheet($view->baseUrl . '/css/smoothness/jquery-ui-1.8.16.custom.css');`
输出是一个空白页面,并显示以下错误消息:
致命错误:未捕获的异常“Zend_Loader_PluginLoader_Exception” 消息“在注册表中未找到名为“JQuery”的插件; 使用的路径: ZendX_JQuery_View_Helper_: ZendX/JQuery/View/Helper/ Zend_View_Helper_:Zend/View/Helper/'
所以,显然尝试添加更多代码
$view->jQuery()->enable();
$view->jQuery()->uiEnable();
根本没用...
我真的需要这个所谓的“助手”b/ci 不想加载另一个页面,但它花了很多时间时间和我在网络上找到的每个解决方案根本不适用于我的应用程序,这令人沮丧......这应该需要 5 或 10 分钟才能实现,但我已经花了几个小时在这上面没有任何作用!
问题1:我是否选择了错误的框架...?
我开始认为旧的时尚方式更好(意味着在没有框架的情况下手动创建应用程序)并稍后关注安全问题,对此的一些评论将会很棒。
非常感谢任何帮助。
I'm trying to include the jquery helper in my zend project, documentation from zend is kind of ambiguous, it indicates to use a few lines of code in bootstrap but there are quite some functions like _initDoctype
/ _initView
/ _initViewHelpers
/ _initAutoload
but it doesn't say where exactly i have to paste the provided code. I pasted it in the _initDoctype
one, is that good enough???
using this line of code is ok so far:
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
when adding this line for a js file or for a simple css file the application crashes bad:
$view->jQuery()->setLocalPath($view->baseUrl . '/js/jquery-1.6.4.min.js');
$view->jQuery()->addStylesheet($view->baseUrl . '/css/smoothness/jquery-ui-1.8.16.custom.css');`
output is a blank page with the following error message:
Fatal error: Uncaught exception 'Zend_Loader_PluginLoader_Exception'
with message 'Plugin by name 'JQuery' was not found in the registry;
used paths: ZendX_JQuery_View_Helper_: ZendX/JQuery/View/Helper/
Zend_View_Helper_: Zend/View/Helper/'
so, oviously trying to add more code like
$view->jQuery()->enable();
$view->jQuery()->uiEnable();
is simply useless...
I really need this so called "helper" b/c i don't want to load another page, but it's taken a lot of time and every solution I found over the Web simply doesn't work with my app, it's frustrating... this should be something to take like 5 or 10 minutes to implement but i've spent HOURS on this and nothing works!
Question 1: did I choosed the wrong framework...?
I'm starting to think that the old fashion way is better (meaning creating the app with by hand with no framework at all) and focus later on security issues, some comments about this will be great.
Any help is truly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在尝试设置 Zend Framework jQuery 帮助程序时遇到了类似的问题。请参阅此SO答案以获取解决方案: 在 Zend Framework 1.9 应用程序中开始使用 jQuery 的最佳方式?
关于您的问题:
这取决于。 Zend Framework 还不错,但是自从学习 Zend Framework 后,我发现了 Ruby 和 Rails 框架,并且我喜欢它。 Ruby 具有非常漂亮、可读的语法,并且 Rails 比 Zend Framework 更容易上手。
I experienced similar issues trying to get the Zend Framework jQuery helpers set up. Refer to this S.O. answer for the solution: Best way to start using jQuery in a Zend Framework 1.9 application?
In regards to your question:
It depends. Zend Framework is not bad, but since learning Zend Framework I have discovered Ruby and the Rails framework and I love it. Ruby has a very nice, readable syntax and Rails is much easier to get started using than Zend Framework.
恐怕PHP中还没有一个理想的框架。虽然 Zend 在某种程度上过于进取且难以掌握,但 Yii 是 Rails 的副本,对于中型网站来说这是一个很好的入门方式。
I am afraid there isn't an ideal framework in PHP. While Zend is somehow over-enterprisy and hard to master, there is Yii, which is a copy of Rails, which is a good way to start for medium websites.