如何使用 Zend_Tool 生成 XML 应用程序配置?
使用 zf create project myproject
创建新项目时,它将在 configs 文件夹中创建一个带有 application.ini 的默认项目布局。我可以在哪里更改这些默认设置,以便生成(并使用)XML 文件 (application.xml)?我查看了 Zend_Tool 的文档(http://framework.zend。 com/manual/en/zend.tool.html),但似乎没有关于如何执行此操作的信息。
假设您想使用不同的默认文件夹布局(即使用 htdocs 而不是 public 作为文档根),是否也可以指定它?
任何指向相关信息的指针(顺便说一句,我已经查看了快速入门,除非我忽略了它,否则没有提到任何相关内容)?
编辑
我已经尝试创建一个配置文件(存储在 .zf/project/profiles 中),并使用它来创建一个项目(使用 zf create project myproject myprofile< /code>),但这不会改变任何内容,即使新项目根目录中的 .zfproject.xml 文件确实包含
设置。 ..
新项目包含此内容(如您所见,这只是默认设置,仅更改了 applicationConfigFile 的类型):
<?xml version="1.0"?>
<projectProfile type="default" version="1.10">
<projectDirectory>
<projectProfileFile filesystemName=".zfproject.xml"/>
<applicationDirectory classNamePrefix="Application_">
<apisDirectory enabled="false"/>
<configsDirectory>
<applicationConfigFile type="xml"/>
</configsDirectory>
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Error"/>
</controllersDirectory>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Error">
<viewScriptFile forActionName="error"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile filesystemName="Bootstrap.php"/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<docsDirectory>
<file filesystemName="README.txt"/>
</docsDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory enabled="false"/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile filesystemName="index.php"/>
<htaccessFile filesystemName=".htaccess"/>
</publicDirectory>
<projectProvidersDirectory enabled="false"/>
<temporaryDirectory enabled="false"/>
<testsDirectory>
<testPHPUnitConfigFile filesystemName="phpunit.xml"/>
<testApplicationDirectory>
<testApplicationBootstrapFile filesystemName="bootstrap.php"/>
</testApplicationDirectory>
<testLibraryDirectory>
<testLibraryBootstrapFile filesystemName="bootstrap.php"/>
</testLibraryDirectory>
</testsDirectory>
</projectDirectory>
</projectProfile>
When creating a new project using zf create project myproject
it will create a default project layout with an application.ini in the configs folder. Where can I change these default settings so that it generates (and uses) an XML file (application.xml)? I've looked at the documentation for Zend_Tool (http://framework.zend.com/manual/en/zend.tool.html), but there seems to be no information on how to do this.
And suppose you'd like to use a different default folder layout (ie. use htdocs instead of public as your document root), is there a way to specify this as well?
Any pointers to relevant information (btw I've looked at the Quickstart, nothing relevant is mentioned there unless I'm overlooking it)?
edit
I already tried creating a profile (stored in .zf/project/profiles), and used that to create a project (using zf create project myproject myprofile
) but that doesn't change anything, even though the .zfproject.xml file in the root of the new project does contain the <applicationConfigFile type="xml"/>
setting...
The new project contains this (as you can see, it's just the default settings, only the type of applicationConfigFile has been changed) :
<?xml version="1.0"?>
<projectProfile type="default" version="1.10">
<projectDirectory>
<projectProfileFile filesystemName=".zfproject.xml"/>
<applicationDirectory classNamePrefix="Application_">
<apisDirectory enabled="false"/>
<configsDirectory>
<applicationConfigFile type="xml"/>
</configsDirectory>
<controllersDirectory>
<controllerFile controllerName="Index">
<actionMethod actionName="index"/>
</controllerFile>
<controllerFile controllerName="Error"/>
</controllersDirectory>
<formsDirectory enabled="false"/>
<layoutsDirectory enabled="false"/>
<modelsDirectory/>
<modulesDirectory enabled="false"/>
<viewsDirectory>
<viewScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Index">
<viewScriptFile forActionName="index"/>
</viewControllerScriptsDirectory>
<viewControllerScriptsDirectory forControllerName="Error">
<viewScriptFile forActionName="error"/>
</viewControllerScriptsDirectory>
</viewScriptsDirectory>
<viewHelpersDirectory/>
<viewFiltersDirectory enabled="false"/>
</viewsDirectory>
<bootstrapFile filesystemName="Bootstrap.php"/>
</applicationDirectory>
<dataDirectory enabled="false">
<cacheDirectory enabled="false"/>
<searchIndexesDirectory enabled="false"/>
<localesDirectory enabled="false"/>
<logsDirectory enabled="false"/>
<sessionsDirectory enabled="false"/>
<uploadsDirectory enabled="false"/>
</dataDirectory>
<docsDirectory>
<file filesystemName="README.txt"/>
</docsDirectory>
<libraryDirectory>
<zfStandardLibraryDirectory enabled="false"/>
</libraryDirectory>
<publicDirectory>
<publicStylesheetsDirectory enabled="false"/>
<publicScriptsDirectory enabled="false"/>
<publicImagesDirectory enabled="false"/>
<publicIndexFile filesystemName="index.php"/>
<htaccessFile filesystemName=".htaccess"/>
</publicDirectory>
<projectProvidersDirectory enabled="false"/>
<temporaryDirectory enabled="false"/>
<testsDirectory>
<testPHPUnitConfigFile filesystemName="phpunit.xml"/>
<testApplicationDirectory>
<testApplicationBootstrapFile filesystemName="bootstrap.php"/>
</testApplicationDirectory>
<testLibraryDirectory>
<testLibraryBootstrapFile filesystemName="bootstrap.php"/>
</testLibraryDirectory>
</testsDirectory>
</projectDirectory>
</projectProfile>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好问题。
您需要某种项目简介。查看:
library\Zend\Tool\Project\Provider\Project.php
有一个带有默认配置的部分。
上周有一个很好的 VideoScreencast 解释了如何创建自己的 Zend 工具提供程序,我认为这会有所帮助。
更新:
我检查了源代码,看起来文件名不可更改。
无法找到将其设置为 xml 的方法。
Zend 工具简介
Good Question.
You need some kind of project profile. Have a look in:
library\Zend\Tool\Project\Provider\Project.php
There is an section with an default config.
Last week there was an good VideoScreencast explaining how to create your own Zend Tool Providers, i think this can help.
Update:
I have checked the sourceCode, looks like the filename is not changeable.
Was not able to found an method to set it to xml.
Introducing Zend Tool