?
Solved

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

Posted on 2012-09-10
8
Medium Priority
?
394 Views
Last Modified: 2012-10-12
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?
0
Comment
Question by:tiv008
  • 5
  • 3
8 Comments
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 38452728
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
 

Author Comment

by:tiv008
ID: 38452767
ingwa,

can i have forms, views, and javascript files in a plugin?  how do i do that?
0
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 38452848
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:tiv008
ID: 38456917
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
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 38457123
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
 
LVL 18

Accepted Solution

by:
Mark Gilbert earned 1500 total points
ID: 38460822
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
 

Author Comment

by:tiv008
ID: 38461343
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
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 38463994
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month15 days, 13 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question