This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Setup & design » Multiple Siteaccess/Design Solution
expandshrink

Multiple Siteaccess/Design Solution

Multiple Siteaccess/Design Solution

Wednesday 16 September 2009 1:42:54 am - 10 replies

Hi everyone,

After about a day of fun with ini files, and from several other forum posts on the subject, I have finally figured a way to get multiple siteaccess going on a single eZ 4.1.3 install, with:

- Independent CSS
- Independent templates
- Independent images
- Independent javascript files

I am using ez 4.1.3 with ezwebin 1.4.2, but this should still apply to at least all in the 4.1.x series. Note that I am using the host match method with a new hostname pointing to each siteaccess - this is just for clarity (I've seen too many uses of 'ezwebin_whatever' as siteaccess names which confuses the hell out of me), but this will equally work with the port match or any other matching method.

The 'secret' although it shouldn't really have come to this - is a combination of the "extension directory method" and the "design directory method":

1). Create all your siteaccesses in the settings/siteaccess directory as normal.
2). In the 'extension' directory, create a new empty directory for each extension-siteaccess and name identically to your siteaccesses.
3). Inside each new empty extension-siteaccess directory create empty 'design' and 'settings' directories.
4). Copy the entire extension/ezwebin directory into each of your new 'design' directories.
5). Create a fresh design.ini.append.php in each of your new 'settings' directory. For now it should contain only the following:

[ExtensionSettings]
# my-design-1 is obvousely an example, use your own siteaccess name here:
DesignExtensions[]=my-design-1

6). Create an empty directory in eZ's root 'design' directory named identically for each of your siteaccesses.
4). Inside each of these new directories, create softlinks/symlinks/shortcuts to each of the ezwebin 'resource' directories (<i>images</i>, <i>stylesheets</i>, <i>javascript</i>, <i>templates</i>blunk.gif Emoticon located within the appropriate extension directory.

<b>Your directory structure should roughly look like this:</b>

+ ezpublish
 +-- settings
  +-- override
  +-- siteaccess
   +-- my-design-1
   +-- my-design-2
   +-- my_admin
 +-- extension
  +-- ezwebin
  +-- my-design-1
   +-- design
    +-- ezwebin
   +-- settings
    -- design.ini.append.php
  +-- my-design-2
   +-- design
    +-- ezwebin
   +-- settings
    -- design.ini.append.php
 +--design
  +-- admin
  +-- base
  +-- my-design-1
   -- images -> /path/to/ezpublish/extension/my-design-1/design/ezwebin/images
   -- javascript -> /path/to/ezpublish/extension/my-design-1/design/ezwebin/javascript
   -- templates -> /path/to/ezpublish/extension/my-design-1/design/ezwebin/templates
   -- stylesheets -> /path/to/ezpublish/extension/my-design-1/design/ezwebin/stylesheets
  +-- my-design-2
   -- images -> /path/to/ezpublish/extension/my-design-2/design/ezwebin/images
   -- javascript -> /path/to/ezpublish/extension/my-design-2/design/ezwebin/javascript
   -- templates -> /path/to/ezpublish/extension/my-design-2/design/ezwebin/templates
   -- stylesheets -> /path/to/ezpublish/extension/my-design-2/design/ezwebin/stylesheets

Now edit these specific parts of site.ini.append.php in settings/override and in each of your settings/siteaccess directories:

<b>override/site.ini.append.php:</b>

[ExtensionSettings]
ActiveExtensions[]
ActiveExtensions[]=my-design-1
ActiveExtensions[]=my-design-2
ActiveExtensions[]=ezwebin
ActiveExtensions[]=ezodf
ActiveExtensions[]=ezoe
ActiveExtensions[]=ezdeploy
ActiveExtensions[]=ezurlaliasmigration

[SiteSettings]
# Nothing here

[DesignSettings]
AdditionalSiteDesignList[]
AdditionalSiteDesignList[]=ezwebin

[SiteAccessSettings]
MatchOrder=host
HostMatchType=map
HostMatchMapItems[]=design1-my-domain.co.nz;my-design-1
HostMatchMapItems[]=design2-my-domain.co.nz;my-design-2
HostMatchMapItems[]=my-domain.co.nz:8095;my_admin
CheckValidity=false
# To remove index.php from all URLs
ForceVirtualHost=true

<b>siteaccess/my-design-1/site.ini.append.php:</b>

[ExtensionSettings]
# Nothing here

[SiteSettings]
SiteName=Design 1
SiteURL=design1-my-domain.co.nz
LoginPage=embedded
AdditionalLoginFormActionURL=http://my-domain.co.nz:8095/my_admin/user/login
# Use the object id of the content-object you wish to see as the main page/entry-point to this siteaccess
# Hint: You can get this by mousing over it in the admin siteaccess
IndexPage=/content/view/full/347
DefaultPage=/content/view/full/347
RootNodeDepth=2

[SiteAccessSettings]
PathPrefix=<Title of folder used as root node in 'IndexPage' and 'DefaultPage' settings above>
PathPrefixExclude[]=Media
AvailableSiteAccess[]=my-design-1
AvailableSiteAccess[]=my_admin

[DesignSettings]
SiteDesign=my-design-1

<b>siteaccess/my-design-2/site.ini.append.php:</b>

[ExtensionSettings]
# Nothing here

[SiteSettings]
SiteName=Design 2
SiteURL=design2-my-domain.co.nz
LoginPage=embedded
AdditionalLoginFormActionURL=http://my-domain.co.nz:8095/my_admin/user/login
# Use the object id of the content-object you wish to see as the main page/entry-point to this siteaccess
# Hint: You can get this by mousing over it in the admin siteaccess
IndexPage=/content/view/full/348
DefaultPage=/content/view/full/348
RootNodeDepth=2

[SiteAccessSettings]
PathPrefix=<Title of folder used as root node in 'IndexPage' and 'DefaultPage' settings above>
PathPrefixExclude[]=Media
AvailableSiteAccess[]=my-design-2
AvailableSiteAccess[]=my_admin

[DesignSettings]
SiteDesign=my-design-2

Clear your cache and check your sites!

Good luck,
Russ

Modified on Tuesday 11 January 2011 9:54:51 am by Nicolas Pastorino

Wednesday 16 September 2009 10:27:04 pm

You should be able to do it without the symbolic links and copying webin design (by not copying it you save your self a lot of work later when upgrading).
This is how:
* skip the symbolic links
* skip copying the files from ezwebin
1. In each of the extensions create the design name, like:
extension/my-design-1/design/my-design-1
2. Copy _only_ the files you want to edit/change in ezwebin and other design you might use (like standard) to the same exact path inside your own design (extension/my-design-1/design/my-design-1/templates/pagelayout.tpl)
3. if you copy a css file, make sure you also copy all the images it uses as image paths in css are relative.
4. In your siteaccesses make sure you setup properly the design order, like:

[DesignSettings]
SiteDesign=my-design-1
AdditionalSiteDesignList[]
# Uncomment this if your using ezflow
#AdditionalSiteDesignList[]=ezflow
AdditionalSiteDesignList[]=ezwebin
AdditionalSiteDesignList[]=base

If you in step 1 just call your design 'ezwebin' (or ezflow), then you don't need to think about step 4. BUT! you do have to care about extension loading in this case (you actually should anyway to make sure you can override settings in these extensions as well). And your examples gets it correct ( my-design-* is above ezwebin ).

Friday 18 September 2009 5:48:47 am

Hi André,

Thanks for your feedback. I have at last, reverted my tree to how it should be according to your instructions. It wasn't quite as simple as you described, but this may due to my having done some 'custom' things along the way.

Cheers once again,
Russell happy.gif Emoticon

Monday 21 September 2009 8:09:38 pm

Hi Russ, this was a great writeup. Would you consider incorporating what you learned from implementing André's suggested changes, expand on it a bit, and create an Article to be posted here on ez.no? That would be invaluable to new users like myself.

In my opinion, eZ Publish really needs more documentation like this: Concrete and specific, rather than general and vague.

Sunday 27 September 2009 9:20:42 pm

Hi Jamie,

A good idea - I was thinking of doing the same myself. I have started such an article and hope to be able to submit it review to the eZ crew soon.

I need to make sure what I have is accurate and so will need to spend some time installing a fresh eZ install, and going through my own article - just to make sure it's 100% accurate!

Thanks a lot,
Russell

Monday 01 February 2010 5:26:44 pm

A related discussion popped up here : http://share.ez.no/forums/setup-d...alone-ez-instance-pros-cons-feedback

Cheers,

Saturday 24 April 2010 11:24:05 pm

I've been working/thinking about this a bit now, and I think I've come up with a solution that'll enable you to have all your extensions and sites/siteaccesses structured outside of ez publish, and have a build script that'll do all the "hard work" setting up the installation for you, based on the extensions and siteaccesses you choose to include at that time. Which basically means that you can easily split them up into separate installations, or have them all in the same, whatever suits you (the site) best.

Here's the structure of the code outside of ez publish:

root

    extension
        custom_extension1
        custom_extension2

    sites
        sitename
            extension
                site_extension1
                site_extension2
            siteaccess
                sitename_eng
                sitename_admin

    build.xml
    build.properties

When you build this, it'll checkout / copy the core of eZ Publish and place it in a folder you choose and put all the extensions and siteaccess you wish to include (all, or a specified list), into the installation.

root / sites / sitename / extension goes into ez-installation / extension

root / sites / sitename / siteaccess goes into ez-installation / settings / siteacess

root / extension goes into ez-installation / extension

When you build this for development, the extensions and siteaccess will be symlinks inside the installation, but if you build if for production / distribution, it will copy each extension / siteaccess into the installation instead, so you're able to have each installation standalone, and isolated from each other.

You can take this even further, splitting settings into environment-specific folders (development, integration, preprod, production), and have the build-script copy/link the correct settings based on what you're building for.

The only downside I can see to this right now is that you have to be careful with the settings / override folder. You really shouldn't use it all, since it can potentially ruin every single installation you have. But you kind of should be careful with that folder anyway...

Any thoughts on this?

Wednesday 09 June 2010 1:28:34 am

There is now a tutorial on this topic here.

Friday 18 June 2010 1:55:14 pm

Nice tutorial ...

I've done that tricks before when I was using eZPublish version 4.0.2.

But since I upgraded to eZ 4.2 and 4.3 now, I had a new problem, when I add a new extension site. I have to add PolicyOmitList[]=content/view into the site.ini.append.php in the extension/mysite/settings. Because if I don't do that, anonymous user can't read any content, they have to login although I has add role policy (content-read) from siteadmin.

So my question is, is it really necessary to add PolicyOmitList[]=content/view into the site.ini.append.php? Because at earlier version (4.0.2) I don't have to to that.

Wednesday 29 December 2010 11:45:29 am

The reply has been removed because of violation of forum rules.

Friday 31 December 2010 5:31:45 pm

Hey, guys

First of all, thank you for the tutorials! They are invaluable for creating new sites with ez publish, I do believe that eZ should give lot more attention to this area of their site.

Now, about my issue: I want to create a development section and an online section. Also, for the development section I want to create a new design. I am really new to eZ Publish, I jut set up a little site with it in which I let users from the old site know in what development stage is the new site. I currently have all the scripts I need for the actual site, I just have to implement them to eZ Publish.

So, I have my sections, one online, one for development (I have a folder as root node that contains 2 frontpages, one is the root node of standard section, the other the root node of development section). The new section was created from the admin control panel -> sections. I also created a new folder in settings/siteaccess that is just a copy of the eng folder, with some modifications. The problem is that I cannot link the section created in the control panel with the new folder (that should link to the custom design). I have added this to site.ini.append.php from the development siteaccess folder:

IndexPage=/content/view/full/118
DefaultPage=/content/view/full/118
...
SiteDesign=my_custom_design

Where 118 is the node id of the frontpage for development and my_custom_design is the name of the extension that includes the design (so it has a design/my_custom_design/templates folder). Also, I have added to content.ini.append.php:

[NodeSettings]
RootNode=118

Any help, please?

...........................................................

Later edit: after several hours of playing around, I realized that I forgot that I changed the settings/override/site.append.ini.php and that accessing the url from the sitelist[] created by me would automatically make the connections that I needed. So I now have the development version that nobody but admins will be able to access and I will be able to replace the site with the development version with only some clicks.

Modified on Friday 31 December 2010 9:01:02 pm by Sao Tavi

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from