Question

This is open to any suggestions and was wondering if a Zend Framework user could help me with this.

I've built medium sized database driven websites using the Zend framework and can see it is a very powerful framework.

However, from looking at something as large as StackExchange.com, was wondering how you could implement a multisite project using zend, with the ability to create a 'main' website, which could be simply duplicated using a config and be held on a different domain, but have certain features extended.

I'm not meaning, copy the site and link to the same framework, but using the framework, extend the main website, (stackexchange.com) to have the main forum like features but to create a complete separate site (stackoverflow.com) which can have the same features or more where required.

The reason i ask is because im not of the impression the stackexchange developers would have to rebuild a site each time, nor do I believe they have 79 copies of the site, linking to one or multiple framework libraries.

If any stack overflow developers or zend geeks could shed any light on this I would be a happy dude.

Thanks!

Was it helpful?

Solution

A single app - not just a single copy of the Zend library - serving multiple (sub)domains can be implemented by using hostname routes.

At the DNS and virtual-host level, all the domains map to a single public folder. The .htaccess there pushes all requests through index.php. This index.php points to a single APPLICATION_PATH. At bootstrap, hostname routes can be used to identify the domain on which the request was made. A front controller plugin with routeShutdown() hook can then read additional hostname-specific config and take other hostname-specific actions (setting layout, for example).

OTHER TIPS

I believe a modular approach would work best here.

I think David Weinraub has a good approach in terms of using a front controller routeshutdown() hook - and I'd do the same, however use it to set the default module, e.g. www.site1.com would look serve content from the site1 module - which extends the Core module.

I'd setup the application in a similar way to the below:

|Project
    |-Application
        |-configs
        |-controllers
        |-models
        |-modules
            |-core
            |-site1
            |-site2
            |-site3
        |-views
        |-Bootstrap.php
    |-Docs
    |-Library
    |-Public
    |-.zfproject.xml

Using the Core module, the 'sub-sites' would extend the Controllers from the Core module and provide the functionality you were looking for

'which can have the same features or more where required.'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top