Multiple Sites, RootNodeDepth, and $module_result.path

Author Message

Jordan Hirsch

Tuesday 19 May 2009 4:41:25 pm

I am setting up a site with multiple domains on eZ Publish 4.1.1. I have my siteaccesses set up correctly so that each siteaccess has its own set of INI files and its own design folder. My problem is that I want each site to have its own root node be a different place in the content tree, e.g.:

Home
  |
  --Folder A [node 100]
    |
    --Article 1
    --Article 2
  |
  --Folder B [node 200]
    |
    --Article 3
    --Article 4

I would like www.siteA.com to start at node 100, and www.siteB.com to point to node 200. Simple enough, I set the IndexPage property for each siteaccess to either /content/view/full/100 or /content/view/full/200. However, that wasn't enough make the site work the way I'd expect. When I browsed to Article 1, for example, I was still seeing "/Folder A/" in the URL. So I added "Folder A" to the PathPrefix for that siteaccess, and the problem went away...

<b>The Problem</b>
But I'm still seeing unexpected behavior. For example, the $module_result.path array for Article 1 still contains "Home". That array is used by the default ezwebin page_head.tpl to create the reverse-listed <title> tags on the site - I'd like to keep using that, but I have to manually strip out the first entry of the array every time I use $module_result.path. That seems wrong.

In addition, when I fetch my root node by the following method:

{def $root_node=fetch( 'content', 'node', hash( 'node_path', '/') )}

it returns node 2, the "Home" node, instead of node 100.

<b>What I Tried</b>
I read in another forum post (http://ez.no/developer/forum/suggestions/a_way_to_change_the_root_node_of_a_siteaccess/re_a_way_to_change_the_root_node_of_a_siteaccess__9) that I should set RootNode (in content.ini) as well as RootNodeDepth and DefaultPage (in site.ini) as well as removing RootNodeDepth from override.ini. Elsewhere in the forums it sounded like RootNodeDepth was the answer to my problem of "locking" a siteaccess into its own section of the content tree. I tried the following:

(site.ini.append.php)
[SiteSettings]
IndexPage=/content/view/full/100
DefaultPage=/content/view/full/100
RootNodeDepth=2

(content.ini.append.php)
[NodeSettings]
RootNode=100

That had no effect, and there's actually a documentation comment indicating that DefaultPage does something entirely different: http://ez.no/doc/ez_publish/technical_manual/4_0/reference/configuration_files/site_ini#comment20548

To complicate matters, RootNodeDepth, RootNode, and DefaultPage are not in the 4.0 documentation at all. Can anyone please tell me what I should do to limit each siteaccess to its own section of the content tree the way I've described above?

Thank you!

Me: http://jordan.teamhirsch.com
My blog: http://wiredformusic.blogspot.com
My other company: http://thinkimprov.com
eZ Certification: http://auth.ez.no/certification/verify/402488
eZ Award: http://ez.no/company/news/ez_awards_2007_prize_winners

Steven E. Bailey

Tuesday 19 May 2009 11:15:50 pm

site.ini
[SiteSettings]

IndexPage=/content/view/full/100
DefaultPage=/content/view/full/100

admin siteaccess - contentstructuremenu.ini
[TreeMenu]
RootNodeID=100

This alone works for us on a 4.01 installation... with 100 being a child of node 2.

Although I don't know if that fixes your specific problems. We override that node and have a custom pagelayout for the other root node and don't run into these kinds of problems.

/1/2/ is always going to be in the path array in the database I think, so you'll have to rewrite templates to take this into account.

Certified eZPublish developer
http://ez.no/certification/verify/396111

Available for ezpublish troubleshooting, hosting and custom extension development: http://www.leidentech.com

zurgutt -

Wednesday 20 May 2009 1:12:36 am

I have a multisite setup like you are trying to set up.

Short answer - its not that simple. You cannot rely on ini settings only, multiple templates have to be modified.

At first I also thought setting RootNode will do it, but no, setting RootNode to anything else than 2 will mess up the system. Nobody is really sure what it is for, I think, but it should not be touched.

RootNodeDepth is not enough either. It is not available on some pages, and then you get the real root, mightily confusing users.

I have each subsite as extension, there is a folder for each subsite that has folders for content (subsite root), users, media and design (contains copy of site settings object)
Here is rough overview of settings overrides i have for one subsite (you will have different node id's of course)

browse.ini
AliasList[]
AliasList[content]=148
AliasList[users]=149
AliasList[media]=150

content.ini
[NodeSettings]
SubsiteRootNode=148
SubsiteUserRootNode=149
SubsiteMediaRootNode=150
(these values are added by me and used in templates where necessary, instead of relying on RootNode and RootNodeDepth, which dont work like i said)

design.ini
[SiteLookSettings]
SiteLookObjectID=252
(used to locate subsite copy of site settings object)

site.ini
IndexPage=/content/view/full/148/
DefaultPage=/content/view/full/148/
RootNodeDepth=3
DefaultUserPlacement=149

After that you need to modify pagelayout, search, menus, path line, browse template.. maybe something else im not remembering right now.

My setup is 3.9 based, maybe something is improved since but i doubt.

Now, ez publish would be a fantastic system if RootNode setting functioned as one would expect it to function..

Certified eZ developer looking for projects.
zurgutt at gg.ee

André R.

Wednesday 20 May 2009 2:38:39 am

There are some changes, the code that uses RootNodeDepth now clearly states what it is used for:

                  RootNodeDepth is a setting for letting you have a very simple multisite, single database and singe siteaccess setup.
                  The content of the menues will be the same on all system pages like user/login, content/edit 
                  and so on, and also when you surf bellow the defined page_root_depth.
                  The sites will also share siteaccess and thus also the same ez publish design and templates.
                  You can however custimize the design with css using the class on div#page html output:
                  subtree_level_x_node_id_y class

                  Note: It is recommended to turn it of by setting it to 0 for normal sites!

                  Example having 2 or more 'sub-sites' with RootNodeDepth=2:
                    root (menu shows sub sites as menu choices like it will on system pages)
                    - sub site 1 (menu show content of this sub site)
                    - sub site 2 (-- " --)
                    - sub site 3 (-- " --)
                    - sub site 4 (-- " --)
                    - sub site 5 (-- " --)

RootNode should work a bit better as of 4.1. in webin (/ flow) you'll have a ezpagedata operator that calculates all the variables you normally need for a webin site, among others a relative path array based on your rootNode / rootNodeDepth settings. This ($pagedata.path_array) is now used everywhere in pagelayout and its included templates, so should be more consistant now.

But, this:

{def $root_node=fetch( 'content', 'node', hash( 'node_path', '/') )}

Will always return the true root node.
The Root Node settings are used by the templates to make it appear that the site, not the eZ Publish install, has a root page of something else then the real internal root. So don't expect black magic from the api calls / fetch functions.

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

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