We have taken on a site written in Zend framework. We didn't write the site and haven't use the Zend framework before so I'm interested in finding three things.
我们采用了Zend框架编写的网站。我们之前没有编写网站,也没有使用过Zend框架,所以我有兴趣找到三件事。
- How do I add new views to the site, adding in a new folder to the application/views/scripts directory seems to do nothing
- Are there any tutorials on how to add affiliate feeds and setups to a zend site that you can recomend?
- Are there any good tutorials on learning the framework? So far all I've found is vast amounts of material that confuses me
如何向站点添加新视图,将新文件夹添加到application / views / scripts目录似乎什么都不做
是否有任何关于如何将联盟提要和设置添加到您可以推荐的zend网站的教程?
有没有关于学习框架的好教程?到目前为止,我发现的大量材料让我感到困惑
3 个解决方案
#1
to answer your questions in order:
按顺序回答您的问题:
-
You have to find the controller, that will emerge the view you want to add. There are two ways to get a view script rendered. The first one is a naming convention on the view script. The view has to be the same name as the action name of the controller. Like "indexAction" and index.phtml. The other way is to instanciate a view object within the controller and give a string with the view name at runtime. You may want to look at this excerpt:
您必须找到控制器,它将显示您要添加的视图。有两种方法可以呈现视图脚本。第一个是视图脚本的命名约定。视图必须与控制器的操作名称相同。像“indexAction”和index.phtml。另一种方法是在控制器内实例化一个视图对象,并在运行时给出一个带有视图名称的字符串。你可能想看一下这段摘录:
$view = new Zend_View(); $view->a = "Hay"; $view->b = "Bee"; $view->c = "Sea"; echo $view->render('someView.php');
$ view = new Zend_View(); $ view-> a =“Hay”; $ view-> b =“蜜蜂”; $ view-> c =“海”; echo $ view-> render('someView.php');
which I took from http://framework.zend.com/manual/en/zend.view.controllers.html#zend.view.controllers.render
我从http://framework.zend.com/manual/en/zend.view.controllers.html#zend.view.controllers.render上摘取
-
I don't think that I understand what you mean by "affiliate feed"... are you talking about advertising or is it more like content syndication?
我不认为我明白你的意思是“联盟饲料”...你在谈论广告还是更像是内容联合?
-
The first thing you should read may be the Zend Framework Study Guide which you find here: http://www.zend.com/community/downloads. There are many tutorials an howtos out there but, this guide is made from Zend directly and should cover the main topics.
您应该阅读的第一件事可能是您在此处找到的Zend框架学习指南:http://www.zend.com/community/downloads。有很多教程,但是,本指南是直接由Zend制作的,应该涵盖主要主题。
Regards, Mario
#2
Are you adding the appropriate Zend_Controller as well? The Zend_Controller QuickStart is a good place to get started with MVC.
你还添加了适当的Zend_Controller吗? Zend_Controller QuickStart是开始使用MVC的好地方。
You might also look at Zend_Tool, which provides a script to help create the necessary structure.
您还可以查看Zend_Tool,它提供了一个脚本来帮助创建必要的结构。
#3
Basically, views need corresponding controller actions. So the main index action (located, for example, in application/controllers/IndexController.php) would need a corresponding view at /application/views/scripts/index/index.phtml.
基本上,视图需要相应的控制器动作。因此,主索引操作(例如,位于application / controllers / IndexController.php中)需要在/application/views/scripts/index/index.phtml中提供相应的视图。
example: To reach an action within the Index Controller named fooAction() you would need a view file at /application/views/scripts/index/foo.phtml.
示例:要在名为fooAction()的索引控制器中访问某个操作,您需要在/application/views/scripts/index/foo.phtml中显示一个视图文件。
example: To reach the index action of contact controller you would need the controller at /application/controllers/ContactController.php (with an indexAction() inside it) and the view at /application/views/scripts/contact/index.phtml.
示例:要获得联系人控制器的索引操作,您需要/application/controllers/ContactController.php中的控制器(其中包含indexAction())和/application/views/scripts/contact/index.phtml中的视图。
Getting beyond the absolute basics... view rendering can also be turned off or redirected but that is getting beyond the basics. Also if the app uses Zend_Layout there will be a layout file located somewhere like application/layouts/scripts/layout.phtml
超越绝对基础...视图渲染也可以关闭或重定向,但这已经超出了基础。此外,如果应用程序使用Zend_Layout,将会有一个位于应用程序/布局/脚本/ layout.phtml之类的布局文件
Clear, concise and current ZF info can be strangely hard to come by. For tutorials check out:
清晰,简洁和当前的ZF信息可能很难得到。有关教程,请查看:
- The ZF Quickstart
- Rob Allen's tutorial
- Some screencasts
ZF快速入门
Rob Allen的教程
For adding feeds I suppose you should check out the framework's documentation for Zend_Feed
对于添加提要,我想你应该查看Zend_Feed的框架文档
#1
to answer your questions in order:
按顺序回答您的问题:
-
You have to find the controller, that will emerge the view you want to add. There are two ways to get a view script rendered. The first one is a naming convention on the view script. The view has to be the same name as the action name of the controller. Like "indexAction" and index.phtml. The other way is to instanciate a view object within the controller and give a string with the view name at runtime. You may want to look at this excerpt:
您必须找到控制器,它将显示您要添加的视图。有两种方法可以呈现视图脚本。第一个是视图脚本的命名约定。视图必须与控制器的操作名称相同。像“indexAction”和index.phtml。另一种方法是在控制器内实例化一个视图对象,并在运行时给出一个带有视图名称的字符串。你可能想看一下这段摘录:
$view = new Zend_View(); $view->a = "Hay"; $view->b = "Bee"; $view->c = "Sea"; echo $view->render('someView.php');
$ view = new Zend_View(); $ view-> a =“Hay”; $ view-> b =“蜜蜂”; $ view-> c =“海”; echo $ view-> render('someView.php');
which I took from http://framework.zend.com/manual/en/zend.view.controllers.html#zend.view.controllers.render
我从http://framework.zend.com/manual/en/zend.view.controllers.html#zend.view.controllers.render上摘取
-
I don't think that I understand what you mean by "affiliate feed"... are you talking about advertising or is it more like content syndication?
我不认为我明白你的意思是“联盟饲料”...你在谈论广告还是更像是内容联合?
-
The first thing you should read may be the Zend Framework Study Guide which you find here: http://www.zend.com/community/downloads. There are many tutorials an howtos out there but, this guide is made from Zend directly and should cover the main topics.
您应该阅读的第一件事可能是您在此处找到的Zend框架学习指南:http://www.zend.com/community/downloads。有很多教程,但是,本指南是直接由Zend制作的,应该涵盖主要主题。
Regards, Mario
#2
Are you adding the appropriate Zend_Controller as well? The Zend_Controller QuickStart is a good place to get started with MVC.
你还添加了适当的Zend_Controller吗? Zend_Controller QuickStart是开始使用MVC的好地方。
You might also look at Zend_Tool, which provides a script to help create the necessary structure.
您还可以查看Zend_Tool,它提供了一个脚本来帮助创建必要的结构。
#3
Basically, views need corresponding controller actions. So the main index action (located, for example, in application/controllers/IndexController.php) would need a corresponding view at /application/views/scripts/index/index.phtml.
基本上,视图需要相应的控制器动作。因此,主索引操作(例如,位于application / controllers / IndexController.php中)需要在/application/views/scripts/index/index.phtml中提供相应的视图。
example: To reach an action within the Index Controller named fooAction() you would need a view file at /application/views/scripts/index/foo.phtml.
示例:要在名为fooAction()的索引控制器中访问某个操作,您需要在/application/views/scripts/index/foo.phtml中显示一个视图文件。
example: To reach the index action of contact controller you would need the controller at /application/controllers/ContactController.php (with an indexAction() inside it) and the view at /application/views/scripts/contact/index.phtml.
示例:要获得联系人控制器的索引操作,您需要/application/controllers/ContactController.php中的控制器(其中包含indexAction())和/application/views/scripts/contact/index.phtml中的视图。
Getting beyond the absolute basics... view rendering can also be turned off or redirected but that is getting beyond the basics. Also if the app uses Zend_Layout there will be a layout file located somewhere like application/layouts/scripts/layout.phtml
超越绝对基础...视图渲染也可以关闭或重定向,但这已经超出了基础。此外,如果应用程序使用Zend_Layout,将会有一个位于应用程序/布局/脚本/ layout.phtml之类的布局文件
Clear, concise and current ZF info can be strangely hard to come by. For tutorials check out:
清晰,简洁和当前的ZF信息可能很难得到。有关教程,请查看:
- The ZF Quickstart
- Rob Allen's tutorial
- Some screencasts
ZF快速入门
Rob Allen的教程
For adding feeds I suppose you should check out the framework's documentation for Zend_Feed
对于添加提要,我想你应该查看Zend_Feed的框架文档