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

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

eZ debug

Timing: Jan 30 2025 00:18:27
Script start
Timing: Jan 30 2025 00:18:27
Module start 'layout'
Timing: Jan 30 2025 00:18:27
Module start 'content'
Timing: Jan 30 2025 00:18:27
Module end 'content'
Timing: Jan 30 2025 00:18:27
Script end

Main resources:

Total runtime0.0164 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0054 588.2656151.2266
Module start 'layout' 0.00540.0026 739.492236.6797
Module start 'content' 0.00800.0069 776.1719106.3125
Module end 'content' 0.01490.0014 882.484445.9922
Script end 0.0163  928.4766 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002414.4691140.0002
Check MTime0.00116.6785140.0001
Mysql Total
Database connection0.00084.969610.0008
Mysqli_queries0.002615.652630.0009
Looping result0.00000.061110.0000
Template Total0.00116.610.0011
Template load0.00085.024910.0008
Template processing0.00031.575010.0003
Override
Cache load0.00053.119510.0005
General
dbfile0.002515.472180.0003
String conversion0.00000.036440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs