How to setup a project on Zend platform

For programming and general questions on Zend Framework

How to setup a project on Zend platform

Postby jack4319 on Sat Sep 10, 2016 11:18 am

Hi everybody,

How to setup a website base on Zend platform
jack4319
 
Posts: 1
Joined: Sat Sep 10, 2016 11:14 am

Re: How to setup a project on Zend platform

Postby amar9450 on Tue Sep 13, 2016 5:58 am

First,you need to install Zend server on your system.The include_path will already be configured to include Zend Framework.After This,you can select "create your project" option to start your work.
amar9450
 
Posts: 11
Joined: Wed Aug 03, 2016 6:02 am
Location: USA

Re: How to setup a project on Zend platform

Postby dhar9669 on Tue Jan 17, 2017 12:59 pm

To setup Zend Project, You should have at least PHP 5.3.23 with the Apache web server and MySQL, accessible via the PDO extension. Your Apache installation must have the mod_rewrite extension installed and configured.
Apache must be configured to support .htaccess files. This is Configured by changing the setting-
AllowOverride None
to
AllowOverride FileInfo

Then You can install the Zend Project using Composer
php composer.phar create-project --stability="dev" zendframework/skeleton-application path/to/install
Another way to install it by downloading zip from Github Url github. + com/zendframework/ZendSkeletonApplication
Then Unzip it and run following cmd
php composer.phar self-update
php composer.phar install

Let me know if it helps.
dhar9669
 
Posts: 5
Joined: Fri Jan 13, 2017 2:58 pm

Re: How to setup a project on Zend platform

Postby rahu2218 on Fri Apr 07, 2017 7:02 am

jack4319 wrote:Hi everybody,

How to setup a website base on Zend platform


Hi,

Creating Your First Zend Framework-Driven Web Site
Its a good bet that even a very easy example will leave you utterly convinced that frameworks are a development tool you won’t be able to live without.
Create the Directory Structure
By default, the Zend Framework relies upon a highly organized application directory structure known as the conventional modular directory structure. In its most basic form, this structure looks like this:
Web server document root/
index.php
application/
modules/
default/
controllers/
views/
scripts/
This structure opens up the possibility to arrange multiple hosted MVC applications within the same location. In a situation where multiple MVC applications exist, you would add additional module directories under the modules directory. However, for the purposes of the examples in this chapter, we’ll just stick with a single (default) application.
Therefore, a normal Web application might be structured as follows. Note how there are three controllers and each of those controllers matches up to a corresponding view directory:
Web server document root/
index.php
application/
modules/
default/
controllers/
IndexController.php
BookController.php
AboutController.php
views/
footer.phtml
header.phtml
scripts/
about/
contact.phtml
index.phtml
book/
index.phtml
toc.phtml
index/
index.phtml
Don’t worry about the oddly named files and structure too much at this point. Just understand that based on the provided controllers and views and a typical configuration,


Because this directory structure won’t suit every developer, it’s possible to change the default settings;
{mospagebreak title=Create the Front-End Controller}
To begin, create a file named index.php and place the code found in Listing 25-1 inside it. The index.php script is known as the front-end controller and, believe it or not, it will be responsible for ensuring that every request for this application receives the appropriate response. This document should reside in your desired application document root.

Additionally, in the same directory, create a directory named application, and in that directory create a modules directory, and within that a default directory. Finally, within the default directory create two more directories named controllers and views, and within the views directory create a directory named scripts, each of which you’ll use later.
Listing 25-1. The Application’s Front-End Controller (index.php)

<?php

// Load the Front Controller class
require_once(‘Zend/Controller/Front.php’);

// Instantiate an instance of the Front Controller Class
$frontController = Zend_Controller_Front::getInstance();

// Point to the module directory
$frontController->addModuleDirectory(‘./application/modules’);

// Throw exceptions (useful during debugging)
$frontController->throwExceptions(true);

// Start the Front Controller
$frontController->dispatch();

?>
It is assumed the Zend Framework application will reside in the server’s document root. However, because this isn’t always possible, you can use the setBaseUrl() method to override the front-end controller’s default behavior. See the Zend Framework documentation for more information.
The Controllers

Next we’ll create two controllers, namely IndexController.php and AboutController.php. These views should be placed in the directory application/modules/default/controllers. First, create the default controller class (IndexController.php), which defines the action that will occur when the Web site’s home page is requested. This script is shown in Listing 25-2.
Listing 25-2. The IndexController Class (IndexController.php)

<?php

// Load the Zend_Controller_Action class
require_once(‘Zend/Controller/Action.php’);

class IndexController extends Zend_Controller_Action
{

// Accessed through
public function indexAction()
{
$this->view->title = "Welcome to Our Chess Club Web Site!";
}

}

?>
In this example, I’ve created a view property named title that will be used to assign the Web page’s title.

Finally well create one more controller intended to display information pertinent to the Web site’s purpose and, for the sake of demonstration, some information about the visiting user. This controller, titled AboutController.php, is displayed in Listing 25-3.
Listing 25-3. The AboutController Controller (AboutController.php)

<?php

// Load the Zend_Controller_Action class
require_once(‘Zend/Controller/Action.php’);

class AboutController extends Zend_Controller_Action
{

// Accessed through
public function indexAction()
{
$this->view->title = "About Our Chess Club";
}

// Accessed through
public function youAction()
{
// Page title
$this->view->title = "About You!";

// Retrieve the user’s IP address
$this->view->ip = $_SERVER[‘REMOTE_ADDR’];

// Retrieve browser information
$this->view->browser = $_SERVER[‘HTTP_USER_AGENT’];
}

}

?>
rahu2218
 
Posts: 1
Joined: Fri Apr 07, 2017 6:13 am
Location: India


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 3 guests