Tuesday 15 September 2009 4:42:54 pm
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>) 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
Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom
Believe nothing, consider everything.
|