in Zend Frameework, is it possible to pacakage a set of libraries, forms, views, and js files for reuse?

I have a zend app and i want to reuse a subset of its functionality in another zend app.  what is the best/cleanest way to do this?

i thought of separating the functionality into a separate module, but that would only work for forms/views.... i still would have javascript files in the public folder and class files in the libraries folder.

is there any way to combine all these somehow?
tiv008Asked:
Who is Participating?
 
Mark GilbertConnect With a Mentor Senior Performance EngineerCommented:
Hi tiv008, so just been in the zf irc channel and yes, Modules are the way to go.

Here are some pages detailing modules, including best practices etc:

http://framework.zend.com/manual/2.0/en/user-guide/modules.html
http://framework.zend.com/manual/2.0/en/index.html#zend-modulemanager
http://framework.zend.com/manual/2.0/en/modules/zend.module-manager.best-practices.html

Please do let me know how this works out for you as I too am learning ZF.
0
 
Mark GilbertSenior Performance EngineerCommented:
I recommend you do this using Zend plugins. Plugins are basically apps but in a sub folder of plugins/appname and provide all the same directory structure as a native application. By doing it as a plugin the methods you currently have will be executed in their own namespace and thus separate from the rest of your new app.

http://framework.zend.com/manual/2.0/en/modules/zend.mvc.plugins.html
0
 
tiv008Author Commented:
ingwa,

can i have forms, views, and javascript files in a plugin?  how do i do that?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
Mark GilbertSenior Performance EngineerCommented:
Tiv008, I'm fairly new to ZF however yes, you should be able to package all the code necessary with your plugin so that it works as part, or independently of the rest of the application.

The following page shows how to construct these plugins:

http://www.maltblue.com/zend-framework/why-zend-framework-plugins-save-you-time

Another terminology though that you may want to focus on is "Modules" as my terminology of plugins may be off from what ZF terms a plugin.

If modules is indeed the better route to go then this should be a good starter for you:

http://modules.zendframework.com/

Good luck with your project. Hope this helps.
0
 
tiv008Author Commented:
thanks, but neither of those work for me.  A plugin is essentially just a class and wouldnt be comprised of forms, javascript, etc etc.

a module is closer to what i am looking for, but as i stated in my question, modules in Zend wouldnt have javascript files.
0
 
Mark GilbertSenior Performance EngineerCommented:
Ugh, sorry to hear that. I'll get onto the zf IRC channel later on and see if there's a tried and tested way of doing this. As good as ZF is they still tend to do things slightly differently to the way everyone else does things (like cakephp or wordpress for instance). There has to be a way. And failing the chat channel I'll reach out to some engineers I'm in touch with at Zend.
0
 
tiv008Author Commented:
i am sorry ingwa, i should have specified that i am still using Zend 1.11.  it looks like modules have changed a bit in Zend 2.  do you know if i can use javascript files in modules in Zend 1?
0
 
Mark GilbertSenior Performance EngineerCommented:
tiv008, not sure. However, ZF 2 has just been released and is no longer in beta. The last 1.x version I believe was 1.12. I highly recommend updating if you can. The new version brings a lot of improvements, one of which being the modules.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.