eZ Community » Forums » Suggestions » A way to change the root node of a...
expandshrink

A way to change the root node of a siteaccess

A way to change the root node of a siteaccess

Thursday 01 February 2007 3:37:42 pm - 12 replies

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.

Wednesday 07 February 2007 7:02:59 pm

Hello Michael,

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

Regards,

Andreas Tremel

Thursday 08 February 2007 9: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

Modified on Thursday 08 February 2007 9:21:54 am by Ɓukasz Serwatka

Thursday 08 February 2007 11:31:46 am

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

Thursday 08 February 2007 11: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

Thursday 08 February 2007 12:18:59 pm

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

Friday 09 February 2007 2:39:43 pm

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 happy.gif Emoticon

Friday 09 February 2007 4:32:21 pm

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.

Tuesday 27 February 2007 11: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.

Tuesday 24 April 2007 3:00:55 pm

----moderated: spam---

Modified on Tuesday 24 April 2007 3:16:15 pm by luci lucia

Friday 10 April 2009 10: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 !

Wednesday 08 July 2009 4:04:08 pm

Good stuff, will use it soon enough

Monday 09 August 2010 6:37:08 pm

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

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from