Best practice for separating admin and www section of site

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Best practice for separating admin and www section of site

pulpfree
Just decided to take the plunge and use ZF2 to build my next project.
In the past with ZF1 I separated the admin and public sections of the
site: admin.example.com and www.example.com respectively into separate
domains. I found this a better way to manage code as administrative
duties were different. For example the forms etc. required to manage a
product catalog or the site CMS was best separated. The problem was
with config files etc.

Hoping to take full advantage of the DIC in ZF2 and re-use of modules,
I am doing some planning and am looking for advice and best practices
to structure my application. I was planning on creating separate
modules for the admin and www for say the product catalog, i.e.:
ProductsAdmin and ProductsPublic. This would allow me to re-use the
ProductsAdmin module and still make changes to the ProductsPublic in
order to satisfy different layouts, site design etc. I'm using
DoctrineMongoODMModule for the model section that I can then share
between the Admin and Public modules.

My question then is -- would it be best to create 2 subdomains:
admin.example.com and www.example.com that access the same code
library using perhaps event listeners to identify the request and
restrict access to modules accordingly? Or is there a better way to
separate logic and access to the admin and public areas of a site?

Any help is appreciated.
Reply | Threaded
Open this post in threaded view
|

Re: Best practice for separating admin and www section of site

Wil Moore III
This post has NOT been accepted by the mailing list yet.
This post was updated on .
The following two resources should answer your questions:

1. http://mwop.net/slides/2012-03-14-Zf2Modules/Zf2Modules.html#slide18
2. http://packages.zendframework.com/docs/latest/manual/en/zend.mvc.routing.html (go to section: Zend\Mvc\Router\Http\Hostname)

In other words:

1. Two separate modules
2. Each module has hostname route constraints
3. Done
--
Wil Moore III

Best Practices for Working with Open-Source Developers
http://www.faqs.org/docs/artu/ch19s02.html

Why is Bottom-posting better than Top-posting:
http://www.caliburn.nl/topposting.html

DO NOT TOP-POST and DO trim your replies:
http://linux.sgms-centre.com/misc/netiquette.php#toppost
Reply | Threaded
Open this post in threaded view
|

Re: Best practice for separating admin and www section of site

Jurian Sluiman
In reply to this post by pulpfree
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Best practice for separating admin and www section of site

SocalNick
In reply to this post by pulpfree
Rob,

I am doing something similar for my project based on ZF2. The way we handled it is in our index.php, we parse the domain name into a module name, so each site has a module. They other trick is to replace the modules in config/application.config.ini with a set of modules specified in the site module's config/application.config.ini (not standard for ZF2 modules to have this file). This way you can control which modules get loaded for each domain, and not load the admin module in your public facing site.


-Nick


On Tue, May 1, 2012 at 12:14 PM, Ron Dyck <[hidden email]> wrote:
Just decided to take the plunge and use ZF2 to build my next project.
In the past with ZF1 I separated the admin and public sections of the
site: admin.example.com and www.example.com respectively into separate
domains. I found this a better way to manage code as administrative
duties were different. For example the forms etc. required to manage a
product catalog or the site CMS was best separated. The problem was
with config files etc.

Hoping to take full advantage of the DIC in ZF2 and re-use of modules,
I am doing some planning and am looking for advice and best practices
to structure my application. I was planning on creating separate
modules for the admin and www for say the product catalog, i.e.:
ProductsAdmin and ProductsPublic. This would allow me to re-use the
ProductsAdmin module and still make changes to the ProductsPublic in
order to satisfy different layouts, site design etc. I'm using
DoctrineMongoODMModule for the model section that I can then share
between the Admin and Public modules.

My question then is -- would it be best to create 2 subdomains:
admin.example.com and www.example.com that access the same code
library using perhaps event listeners to identify the request and
restrict access to modules accordingly? Or is there a better way to
separate logic and access to the admin and public areas of a site?

Any help is appreciated.