Zend Framework : Modular Application [Part 1]
Project description : A simple guestbook module using Zend Framework 1.11 .
Project
Create new project using Zend_Tool :
zf create project MyApp cd MyApp
Create module :
zf create module Guestbook
Create controller for Guestbook (1 = index action included):
zf create controller Index 1 Guestbook
Now go to /MyApp/application/configs/application.ini and comment/delete the line :
;resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
Then add the lines
;Modular suport resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.modules[] =
And add this lines to set Guestbook as default module
resources.frontController.params.prefixDefaultModule = "1" resources.frontController.defaultModule = "Guestbook"
Create php file “Bootstrap.php” under folder /MyApp/application/modules/Guestbook and past the code
<?php
class Guestbook_Bootstrap extends Zend_Application_Module_Bootstrap{}
Now test your app

Video :
April 25th, 2011 in
Development | tags: 1.11, Framework, php, Zend, Zend Controller, Zend Db-Table, Zend Framework, Zend Module, Zend_Tool, ZF
Great tutorial !
Thank you for your work
What would the correct approach be for adding multiple modules while still retaining the default module for shared components?
modules/default/* (for shared items like authentication [zend_auth] & authorization [zend_acl], etc)
modules/blog/*
modules/catalog/*
So nice!!! Very well explained. You rock!
Please, when will part 2 be available ??
Thanks you so much again!
Cheers!
@Jack Peterson: Indeed. I do believe that would be the approach to take.
thank you I think this will help I was stuck and I so prefer the module structure to the default structure I am coming from joomla and everything there is organized into small packages like the moduler layout of zend thanks again for the tutorial I will post back when done
ok that worked fantastic. First try and I was up and running in 3 minutes flat
Great Work! And a great tutorial. The music was ok but that is nothing to talk about.
I actually learned another important feature – that it is possible to execute those commands from the Zend Studio rather than using the CMD : )
Thank you very much for sharing.
First of all thanks.
How do I use a different layout for every module?
hello,
My folder structure is:
projectfolder/zf-tutorial/application/
1. config
2.modules
in modules there are two folder
1. default
2. backend
and under those folder controller,model,views etc are there.
in my contrloller class I extend model class but it showing (model class)class not found
How do I use a different layout for every module?
Thank You for Your Tutorial, its very usefull for me.
[...] Zend Tools that creates application/modules/xxmodulenamexx instead. Another I have looked into: ? Zend Framework : Modular Application [Part 1] ? Abdelkader ELKALDI – Web Application Develop… This seems to be the best way, but I don't think you can share models with this one. Also, the [...]
How can i add cron job to run task under index controller everyday
OUAAAAAHH!!!
Thx your video is perfect, the tutorial is simple, i wish i could help people too one day..