Forums / Suggestions / A way to change the root node of a siteaccess

A way to change the root node of a siteaccess

Author Message

Michael Maclean

Thursday 01 February 2007 6:37:42 am

I've hacked the templates (flat_left.tpl, flat_top.tpl and path.tpl) to allow me to specify the root node for a siteaccess in site.ini.append.php (I'm calling it SubsiteRootNode under SiteSettings). It would be quite nice to have this as standard, as it's something we use quite often. I'll make the code available to anyone who wants to look in the mean time.

eZpedia community documentation project | http://ezpedia.org

Andreas Tremel

Wednesday 07 February 2007 10:02:59 am

Hello Michael,

I'm interested in the code. Could you send it to me / post it here?

Regards,

Andreas Tremel

Łukasz Serwatka

Thursday 08 February 2007 12:21:28 am

You can do it with code available in ezwebin already. It is combination of IndexPage and
RootNodeDepth:

Trick is following:

In settings/siteaccess/siteaccess_A/site.ini.append.php I set
IndexPage=/content/view/full/145/
RootNodeDepth=2

and in settings/siteaccess/siteaccess_B/site.ini.append.php I set
IndexPage=/content/view/full/146/
RootNodeDepth=2

Where 145 and 146 are node id of folder in structure like:

ContentRootNode
       |
       | - Folder (siteaccess_A) 145
       | - Folder (siteaccess_B) 146

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

ez man

Thursday 08 February 2007 2:31:46 am

Well MIchael you said you will post the code, what happened?

Andreas Tremel

Thursday 08 February 2007 2:43:01 am

Hello Lukasz,

thank you, that works simply great!

There is only one thing that looks a bit unclean:

In my opinion, the information above the root level defined in siteaccess should be invisible.
However, searching will return articles above the root level in the search result list.

Does anyone know how to avoid this?

Regards,

Andreas Tremel

Łukasz Serwatka

Thursday 08 February 2007 3:18:59 am

You can tune it with PathPrefix=folder_name just add it per siteaccess. folder_name it is a url_alias of Folder.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Michael Maclean

Friday 09 February 2007 5:39:43 am

Lukasz: That looks great, I'm just going to try it.

ez man: I didn't check this bit of the forum for the last couple of days. If Lukasz's solution works as well as the code I have, I'm going to use it instead. If it doesn't, I'll be back :)

eZpedia community documentation project | http://ezpedia.org

Michael Maclean

Friday 09 February 2007 7:32:21 am

Hi Lukasz,
That's pretty much exactly what I am after. Thanks! Though to make it look the way I wanted. I had to do something like this in extension/ezwebin/design/ezwebin/templates/parts/path.tpl (or an override of some sort):

  <!-- Path content: START -->
  {if $module_result.path|count|gt($pagerootdepth|dec)}
      {def $virtual_path=$module_result.path|remove(0, $pagerootdepth|dec)}
  {else}
      {def $virtual_path=$module_result.path}
  {/if}
  <p>
  {foreach $virtual_path as $path}
  {if $path.url}
    <a href={cond( is_set( $path.url_alias ), $path.url_alias,
                                        $path.url )|ezurl}>{$path.text|wash}</a>
  {else}
    {$path.text|wash}
  {/if}
  {delimiter}/{/delimiter}
  {/foreach}
  </p>
  <!-- Path content: END -->

That's just to chop the first few entries off. Unless I'm missing something.

eZpedia community documentation project | http://ezpedia.org

Paul Wilson

Tuesday 27 February 2007 2:25:25 am

Just a note to anyone implementing Lukasz's suggestions above ...

I'm using ez 3.9.0 and instead of just adding the site.ini.append.php lines indicated by Lukasz above to the new siteaccess, I found I also had to:

1) remove the same settings from the overide/site.ini.append.php

2) add the values deleted from the override/site.ini.append.php to all of the siteaccesses other than the new one being created.

luci lucia

Tuesday 24 April 2007 6:00:55 am

----moderated: spam---

Benjamin Lorteau

Friday 10 April 2009 1:31:03 am

Hi Michael,

by setting RootNodeDepth, the breadcrumb automatically strips the first elements.

Just to clarify :

In override/site.ini :
- remove default <b>[SiteSettings] RootNodeDepth</b>
In siteaccess/A/site.ini :
- set <b>[SiteSettings] RootNodeDepth</b> to the siteaccess (SA) root node depth
- set <b>[SiteSettings] IndexPag</b>e to /content/view/full/[SA Root Node Id]
- set <b>[SiteSettings] DefaultPage</b> to /content/view/full/[SA Root Node Id]
- set <b>[SiteAccessSettings] PathPrefix</b> to the SA root node url alias
In siteaccess/A/content.ini :
- set <b>[NodeSettings] RootNode</b> to SA root node id

In siteaccess/[other siteaccesses]/site.ini :
- set <b>[SiteSettings] RootNodeDepth</b> to the default (=1)

Phew !

eZ Publish personal project : http://www.aeriesguard.com [fr]

Sylvain Gogel

Wednesday 08 July 2009 7:04:08 am

Good stuff, will use it soon enough

--
http://www.ecedi.fr
Agence Web, Créa/Conseils, Accessibilité
eZPublish, Drupal, Zend, Symfony