Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-26-2007, 07:23 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Question Plugins

I'm trying to figure out how to create plugins. I've read the piece in the Zend Framework documentation on it, but it doesn't seem to be working. I don't know if I need to use both setControllerDirectory() and addControllerDirectory() in the Front object to register my plugin? When I try to access /plugin/controller/action It can't find plugin controller. But it's not a controller, it's a module.

Any tips?

Thanks,
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-26-2007, 09:23 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Question Modules not Plugins

I guess I was confusing plugins with modules. I'm use to cakephp which calls their modules plugins, and it appears that what is a plugin for Zend is a component for cakephp? Anyways, I'm trying to figure out how to use modules. I was able to access the path of my MVC module for the controller, but not when I do a /module/controller/action only when I do a /controller/action

Anyone know what I'm missing?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-26-2007, 09:40 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Question Modules

I was able to figure out that I needed to add my module to my config file so it knows the routes. What I'm wondering now, is there a way for it to find my modules models, and views automatically? Or, do I need to always tell it the whole path to find where they are located when I'm trying to render the views or access the models?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-28-2007, 09:52 PM
jap jap is offline
Junior Member
 
Join Date: Apr 2007
Posts: 23
Default

When you use render() zend will automaticly search for /views/scripts/actionname/actionname.phtml

But, you can use custom locations or you can add directories where zend view has to look for the controllers like this:
PHP Code:
$view->addScriptPath('/path/to/app/views');
$view->addScriptPath('/path/to/custom/'); 
You can find more about this here: Zend Framework

I've tried to make the same thing as you are trying now, and it didn't work for me I'm not using the multiple controllers because I wasn't able to render my header and footer.phtml and had no idea how to fix it.

I hope you have more luck or just more skill

Last edited by SpotSec : 05-02-2007 at 05:49 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-29-2007, 05:54 AM
Cristian's Avatar
Administrator
 
Join Date: Feb 2007
Location: Sibiu, Romania
Posts: 99
Default

You didn't tryed this tutorial ?

Zend Framework Tutorial ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-29-2007, 11:27 AM
jap jap is offline
Junior Member
 
Join Date: Apr 2007
Posts: 23
Default

Quote:
Originally Posted by Cristian View Post
You didn't tryed this tutorial ?

Zend Framework Tutorial ?
Yes but that tutorial doesn't cover multi-controller useage
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 05-02-2007, 12:35 AM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 116
Default

Quote:
Originally Posted by jeffrey_stevenson View Post
I was able to figure out that I needed to add my module to my config file so it knows the routes. What I'm wondering now, is there a way for it to find my modules models, and views automatically? Or, do I need to always tell it the whole path to find where they are located when I'm trying to render the views or access the models?
This ability is available for the view, I do not think it is documented yet though, but there is a blog about it somewhere. Unfortunately for the model you will have to extend the Zend_Controller_Action class to do that automatically or you can add your models path on to your include path and that way you can include/require or use Zend_Loader::loadCLass() etc... your model. Another nifty method would be to add the models to your include path and use the php class autoloader (__autoload() or spl_autoload_register())

I think most of this is documented in fine print somewhere in the manual, but hey, this forum is here to help any little problem or misunderstanding . Probably not to the point of doing your project for you but its worth a try asking ain't it? :P

Last edited by SpotSec : 05-02-2007 at 05:50 AM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 05-08-2007, 05:47 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Default

Thanks for all the comments. I have another issue I'm running into. I'm use to CakePHP where I can have so called modules, that include everything for that module to operate, such as css, images, javascript directories. So I can slap a module in (called plugin in cakephp) and it works right away without modifying routes, telling things where to find stuff, ect.

Is there a way to have Zend Framework modules be able to encapsulate the css, img, js directories right in the module so if I move it or put it in a different application I won't need to copy the css, img, js into the document_root of the main Framework application?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 05-08-2007, 09:07 PM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 116
Default

As far as interchangeable modules go, it won't work without modification. And yes you can have modules in the document_root, but this is not a recommended setup as it exposes your webapp to everyone. You could do this and have some sort of acl or .htaccess setup to deny access to the controllers etc...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 05-09-2007, 02:41 PM
Junior Member
 
Join Date: Apr 2007
Posts: 5
Thumbs down Modules

Yeah, I wouldn't ever want my modules in the document_root. I just didn't know if the other directories that are normally in the doc_root, could be placed in the module directory. Oh well. I wish they had a way to do this, because I see it as a real disadvantage. I can somewhat see why they would want it to just use the css that is with the main application to easily incorporate the look and feel, but for javascript and images for the module, this is a poor design. And even if it is using the css of the main application, there are going to be css issues where the module will need to have its own styles to make things look right.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
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 12:20 PM.