Valentin's multisite guide v.1 (example uses eZp v.3.9.4)

Author Message

Valentin Svelland

Saturday 12 January 2008 2:27:20 am

** FEEL FREE TO COPY THIS ENTIRE POSTING, COMPLETE MY GUIDE WITH YOUR COMMENTS, AND INSERT AS NEW POST IN THIS THREAD. REMEMBER TO INCREMENT VERSION NUMBER IN TITLE**

After setting up a multisite installation of eZ Publish v. 3.9.4 I realized that information on this topic was scattered and scarce, so I've decided making a short guide on the topic. I prefer to make an eZ multisite with one database to allow cross-site publishing, but you're free to decide this in your siteaccess-settings.

Be adviced that if you define a separate cache for each siteaccess you'll have to clean cache on each site manually. I would advice not to do this on cache, storage-folder however - just go ahead.

<b>GUIDE</b>

<b>1. Create content subtree for each site</b>
Remember to write down the node-id of your main-node, i.e. the parent of your different subtrees.

IndexPage=/content/view/full/150
DefaultPage=/content/view/full/150

Also you need to set this parameter to avoid crossing over to other sites as topmenu sometimes jumps to top level node when browsing subfolders with articles:

RootNodeDepth=2

This of course supposes all your main nodes of your multiple sites (subtrees) to be on the same level in the content structure of your installation!

<b>2. Set up a siteaccess for each domain </b>
<i>(search forum on this)</i>
Remember to set index pages and main nodes of each siteaccess equal to the node-ids described in bullet point 1:

<b>3. Create vhosts</b>
Make your hosting-company set up a vhost-alias for each domain on server. It's usually a good idea to make aliases for all of your domains at once, in case you want to point more sites to the installation later without having to contact the administrator of your hosting company again.

<b>4. Point dns of each domain to webservers ip.</b>

<b>5. Create template look for each domain</b>
The design section of your eZ Publish administration isn't multisite-proof but I've been successful with the following strategy. Enter this url in your browser:
http://admin.yoursite.no/design/

(Can also be reached by clicking "Design" in admin, then choosing submenu "Visual configuration" on the left. Then cancel this edit-operation and you'll be redirected to the same place.

Anyhow, the point of this is to get an overview of existing objects of "template look"-class and to create a new object of this class for each of your domains. Remember use the existing template look object as your first domaindesign.

<b>6. Create design under ezwebin-extension for each domain:</b>
Create folders:
\extension\ezwebin\design\yourdesign1
\extension\ezwebin\design\yourdesign2
etc.

It's important to copy and rename all of the content in original existing design-folder
\extension\ezwebin\design\ezwebin
If you do not do this stylesheets will not work properly. Overriding folder-structure with just needed files does work, but creates some minor bugs in your design.

Ok, now we need to access the new template look-objects of bullet point 5 from our new design in ezwebin-extension. We do this by changing the array number of line 28 in \extension\ezwebin\design\yourdesign1\pagelayout.tpl:

    {def $pagedesign = $pagedesign_class.object_list[1]}

The original altered template look-object har array number [0]. The next created [1] and so on.

Of course, rewriting the entire design with meta tags manually in siteaccesses would probably be a safer way to do this, but this hack ensures easy changes of your design through the web-interface of the administration of eZ Publish.

<b>7. Roles and permissions</b>
Remember to give the anonymous user access to your new siteaccesses to be able to view them at all. Then you need to copy the editor-role and redefine this for every site if don't want each editor to be able to see all of your sites on the eZ publish installation.

I do this by redefining a copy of Editors-role for each site, and limiting this to node=2 and subtree=id of your main node for each domain.

<b>8. Limit search in multisite installations</b>

When setting up a multisite-installation you usually need to stop visitors from crossing over to other designs when using search-function returning nodes outside your site-subtree.

I do this by including the following line in all templates including a search-form in my design:

<input type="hidden" name="SubTreeArray" value="150" />

Important! Replace the value number with the main node of each of your siteaccess'.

Usually these templates need this update to ensure no crossover-searches between sites in multisite-configurations:
/extension/ezwebin/design/site1/pagelayout.tpl
/extension/ezwebin/design/site1/content/search.tpl
/extension/ezwebin/design/site1/content/advancedsearch.tpl

In the advancedsearch.tpl you simply need to insert your subtree-node-id into the value-parameter in Subtree-section on line 91.

<input type="hidden" name="SubTreeArray[]" value="150" />

<b>9. Design and content</b>
At this point you're ready to work on with design and contenct, but I haven't done much testing on for example overriding stylesheets yet. I know there are some bugs here, but I think this is related to overriding the ezwebin-extension. The routine I have described establishes separate designs within this extension.

------------------------
I made eZ run on www.eigersund.kommune.no, bjerkreim.kommune.no, lund.kommune.no and sokndal.kommune.no. Municipalities should use open source!

André R.

Tuesday 05 February 2008 8:43:33 am

re:
"6. Create design under ezwebin-extension for each domain:"
You should rather create your own design extension then putting your files inside the ezwebin extension. Makes it easier to maintain and upgrade.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Steffen K.

Monday 10 August 2009 3:21:31 pm

For users with eZp v. 4.1.3:

<b>6.</b>
Instead of the given code I had to use in line 15:

$pagedesign       =  fetch( content, object, hash( object_id, 54 ) )

where 54 is the object-ID of the template_look object, which I want to use.

Moreover I deleted all attributes in the template_look class, which write their values in the ini-files and configured the ini-files directly.

Greg McAvoy-Jensen

Tuesday 08 June 2010 4:27:21 pm

There is now a tutorial on this topic here.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.