TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-29-2008, 12:23 AM   #1 (permalink)
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default 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!


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
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko is offline  
Reply With Quote
Old 02-29-2008, 12:34 AM   #2 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

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
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 02-29-2008, 12:40 AM   #3 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

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
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Old 02-29-2008, 12:42 AM   #4 (permalink)
The Contributor
 
abiko's Avatar
 
Join Date: Feb 2008
Location: Croatia
Posts: 90
Thanks: 4
abiko is on a distinguished road
Default

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.

:/
__________________
Back from sysadmins to the programmers.
Send a message via ICQ to abiko Send a message via MSN to abiko
abiko is offline  
Reply With Quote
Old 02-29-2008, 12:46 AM   #5 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

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
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:03 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design