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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2007, 04:17 AM
Junior Member
 
Join Date: Aug 2007
Posts: 3
Default multiple websites, one shared framework

any recommendations for how to structure zend framework for working with multiple websites?

I want to share the core framework and other core classes but still have a lot of flexibility for customizing specific sites.

Also, to take this a step further, how about multiple "concepts", each concept having multiple websites (and all sharing a common framework).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 08-06-2007, 04:17 PM
matias.quaglia's Avatar
Junior Member
 
Join Date: Aug 2007
Posts: 18
Default

Hi Twiddly, i'm not an expert, just a wannabe but i work in this way with ZF (I learned from the Akelos Project.

I work in a shared hosting webserver, so my file structure is something like

Code:
/.    ---------------->(something like /home/user_name/.)
   /zf
      /zf/library
      /zf/docs
      /zf/etc...

   /my_project
      /my_project/app
            /my_project/app/controllers
            /my_project/app/models
            /my_project/app/views
      /my_project/html

   /public_html
First of all I add to the include_path the lybrary located in ./zf/library. I do this through .htaccess:

Code:
<IfModule mod_php5.c>
	php_value include_path "/home/user_name/zf/library/."
</IfModule>
or through bootstrap in ./my_project/html/:

PHP Code:
ini_set('include_path',ini_get('include_path').'.:/home/user_name/zf/library'); 
Then, I just make a symbolic link between a folder in ./public_html (corresponding to a folder of an addon domain --i use cpanel to do this--) and /my_project/html.

If the /public_html folder of my_addon_domain.com is /public_html/my_addon, then i remove this folder and i create a soft link, with the same name than the folder:

Code:
ln -s /home/user_name/my_project/html/ my_addon
Then i can add many addon domains and use just the same lybrary in a single shared hosting account. This may cause serious perfomance problems, of course.

Hope this may give you some ideas.

Cheers.
__________________
Matías Quaglia
==========
http://www.matiasquaglia.com.ar
Credo est Creo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-06-2007, 08:50 PM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 119
Default

Just a few things to consider. When the famework releases new versions there is always the possibility that existing code wil be broken until you can adjust it for the new freamwork version. Setting up 1 framework for multiple sites can ultimately be a recipe for disaster, unless you take to the time to test everything before implenting the new frame work.

that said, probably the easiest way to accomplish what your after is to put the Zend folder in your php include path. check out the phpinfo(); dump and see where your include path is, then just dump the whole Zend folder in there. You should then be able to include any Zend clases with out having to alter you path in your code.

Again, this can become problematic very quickly if you have multiple clients, multiple applications, etc...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-06-2007, 10:01 PM
matias.quaglia's Avatar
Junior Member
 
Join Date: Aug 2007
Posts: 18
Default

Hi Elemental, you are so right!

Quote:
Originally Posted by Elemental View Post
Setting up 1 framework for multiple sites can ultimately be a recipe for disaster, unless you take to the time to test everything before implenting the new frame work.
Who could be so naif to upgrade the core of a framework without testing the release in a non-production server?


Quote:
Originally Posted by Elemental View Post
the easiest way to accomplish what your after is to put the Zend folder in your php include path. check out the phpinfo(); dump and see where your include path is, then just dump the whole Zend folder in there. You should then be able to include any Zend clases with out having to alter you path in your code.
When you are using a shared hosting server you don't have permissions to add files to the include_path, but you can achieve it by .htaccess or php ini_set function.

I think that sharing one core to multiple applications, isn't the best idea, but may be usefull. In any case you can upload multiple copies of it, after all, one of the goals of ZF is the easy installation.

Cheers
__________________
Matías Quaglia
==========
http://www.matiasquaglia.com.ar
Credo est Creo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-10-2007, 12:30 PM
Junior Member
 
Join Date: Aug 2007
Posts: 3
Default dedicated server, thousands of sites

thanks for the replies.

This is a dedicated server, with thousands of websites. I don't want to have to update the framework a thousand times

Sounds like each site would have its own Application dir and share the rest?

Also, the sites all share a common database and are similar in functionality. The look & feel (layout, css) must be configurable per site but otherwise the general features/functions are shared.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 11-01-2007, 09:56 PM
Junior Member
 
Join Date: Nov 2007
Posts: 1
Default

You could install ZF on a global location (like /usr/local/share/ZendFramework-1.0.2) and then symlink to this directory. When you update the framework you install it in /usr/local/share/ZendFramework-1.0.3 and then site by site you can update the symlink.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 11-07-2007, 04:49 PM
Junior Member
 
Join Date: May 2007
Posts: 25
Default subversion

why not use subversion export?

that is what im planning on doing with the next larger scale rollout.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 11-09-2007, 12:10 AM
Elemental's Avatar
Senior Member
 
Join Date: Jul 2007
Posts: 119
Default

I actually spent the better part of today setting up subversion repositories for the bulk of our projects at work.

The solution we finally settled on was using svn:externals pointing to the release tags. Each site we produce now has its own repository. Each repository has a svn:external property pointing to a release tag in the zend repository. When it comes time to update the framework, we simply change the svn:externals property to point to the new release tag and update, test, repair, test, check in, then the live site gets an update as its just a working copy of that site last stable release tag.

The bad side of this is that everysite has a copy of the zf code. Space isn't a problem for us at work, but at home or on a more limiting hard drive you might still want to do the symlink thing.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-22-2008, 12:30 AM
Junior Member
 
Join Date: Apr 2008
Posts: 4
Default

How about a config file which sets all your application paths (controllers, models, etc.) grouped by hostname, and then use compare that against the host header.
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 11:47 AM.