| Windows | Linux | ||||||||||||||||||
WindowsAssuming we're using the "minimal" distribution, the required folder is:ZendFramework-1.9.2-minimal\libraryMove and rename this folder to the following (or to a location of your choosing): C:\ZendLibrary |
|||||||||||||||||||
public/.htaccess reset RewriteBase if necessary public/index.php replace '/usr/local/share/ZendLibrary' if necessary,
ZendHello/ index.php forwards to public/ library/ public/ .htaccess funnel URLs to front controller index.php front controller images/ js/ css/ application/ config.ini database configuration controllers/ IndexController.php controller for "/index" models/ views/ filters/ helpers/ layouts/ layout.phtml layout template scripts/ index/ index.phtml view for "/index/index"The initial appearance is somewhat bewildering with so many files and folders needed to create a simple "hello world" project. The MakeZFProject application permits you to modify each of the seven files created by selecting the file through the Edit menu. Here are the file contents:
if the requested URL is not a file, thenIn particular,
apply the RewriteRule, sending it to the "front controller," index.php (in the same public folder).
Alias /zendhello "THE-PATH-TO/ZendHello/public"
<Directory "THE-PATH-TO/ZendHello/public">
Options IncludesNoExec
AllowOverride None
Order allow,deny
Allow from all
RewriteEngine on
RewriteBase /zendhello
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php
</Directory>
http://... BASE .../controller/actionThe controller part corresponds programatically to a Php class within the applications/controllers directory. The action part corresponds to a member function within that class. The entire pair controller/action is mapped, by default, to a corresponding view script (see below). Separate controllers are thought to make separations between distinct "portions" of the web applications and actions create the behaviors within these separate portions. The entry URL immediately redirects us to In the terms of the framework logic, this defaults to calling the index controller: The index controller, by default, calls the index action: The controller/action creates an instance of the IndexController class, calls the indexAction function and combines these effects with the "index view" below. Data can be created and passed from the controller to the view script through the view member object.
Zend_Layout::startMvc(array('layoutPath' => '../application/views/layouts'));
used in the front controller which makes this possible.
The view content is simply dumped into the body.
Additionally, the headLink and headScript operations
establish "places" for stylesheet links and script files to be added
by the specific controller or view script.
application/views/scripts/contoller/action.phtmlThis, therefore, is the default script used by the index/index controller/action pair.