TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   Zend Framework - questions questions (http://www.talkphp.com/advanced-php-programming/2371-zend-framework-questions-questions.html)

abiko 02-29-2008 12:23 AM

Zend Framework - questions questions
 
I'm planing to rewrite my CMS to fully use Zend Framework.
For now I'm using my own written UserManagment system.
The problem is it is pretty modular, it comes in 3 parts - the core, the user system, the modules.
The main problem is - how do I write modules in Zend Framework and have a class that loads them.
Much help would be appreciated!
:-D

Can I write modules to be in seperate controller directory, eg.
I have
Code:

root/
  ...controllers/
  ...............public/
  ...............modules/
  .......................newsModule/
  .......................galleryModule/

Is the right way of using Zend_Controller_Router - to define the layout od the site, the pages and what modules does that page use.

I'm here a noob, and want go advanced in asecond. lol :D

Alan @ CIT 02-29-2008 12:34 AM

It pretty much depends on how you have implemented your modules. Zend Framework allows for a modular structure such as:

Code:

/application
  /modules
    /default
    /blog
    /gallery
    /forum

Where blog, gallery and forum are all modules with their own controllers and actions. Default is a special module which is essentially the homepage.

You could then go to:

Code:

http://www.yoursite.com/gallery/image/view
Which would translate to:

Code:

Module: gallery
Controller: image
Action: view

I'm guessing though that by modules you mean like a little drop-in module on the side of the page - something like the latest articles plugin here on TalkPHP?

If so, that's no problem with the Zend Framewok. You would create your modules as normal controller/action classes then use the various Helpers that the Zend Framework provides such as the Zend_View Action helper. This allows you to call a specific action from your View and then use the results. The View Action helper was specificly designed to do things like the latest article plugin on the left of this page :-)

Hope that clears it up a bit or if I completely mis-understood what you where asking for, let me know :-)

Alan

Alan @ CIT 02-29-2008 12:40 AM

Oops, just seen you edited post :-)

Modules generally have their own controller directory such as:

Code:

/application
  /modules
    ...
    /gallery
      /controllers
      /views
    /blog
      /controllers
      /views

And so on - this tends to keep things nicely self-contained.

Alan

abiko 02-29-2008 12:42 AM

Here is the thing. I write my modules as little programs that use the core and user part of the CMS as a framework. so they are independent from the other parts of the cms.

I would like my structure to be like this
Code:

controllers/
..core/
..user/
..modules/
.........newsModule
.........galleryModule/

And configure my URL when entered site.com/about-us/ to use newsModule that is added to the about-us page. I know that Zend is loading controllers as in url - site.com/gallery - would load gallery controller. I want to remove this limitation and maybe put a little configure file that says about-us -> module/newsModule controller.

:/

Alan @ CIT 02-29-2008 12:46 AM

Yep, that would be no problem. Zend Framework tries not to force you in to working the way it wants you to so it allows you to fully control what route maps to what module/controller/actions :-)

Alan


All times are GMT. The time now is 06:44 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0