Linking to nodes across siteaccess

Author Message

Sander van den Akker

Wednesday 21 April 2010 5:46:08 am

Hi again. I'm busy building a rather complex multisite with different siteaccess for subdomains. I just tried to link from a node in one siteaccess to another one in another siteaccess in an xml field. This doesn't seem to be working. eZ generates urls like http://www.domain.com/<siteaccess>/link instead of http://<siteaccess>.domain.com/link.

I also noticed eZ Find does not handle indexing of multiple siteaccess in one database correctly, resulting in the same sort of links.

I used the following siteaccess mapping:
MatchOrder=host;uri
HostMatchType=map
HostMatchMapItems[]=sub1.domain.com;sub1
HostMatchMapItems[]=sub2.domain.com;sub2

For some reason eZ is only aware of the currect siteaccess, and does not take the siteaccess a node is in into account when rendering links.

Does anyone have tips how to solve this puzzle?

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

Håvard Bergersen

Saturday 01 May 2010 5:39:19 pm

How does your site.ini file look in the different siteaccesses?

Abdelkader RHOUATI

Monday 03 May 2010 2:22:24 am

Hello,

Does the differents siteaccess use the same database ?

tks

Abdelkader RHOUATI

Blog (french) : http://arhouati.com
----
Extension arh_jdebug : EzDebug using jquery

Håvard Bergersen

Monday 03 May 2010 12:21:41 pm

That was what I was wondering about too..

And if they are listed as related siteaccesses?

David Sayre

Monday 26 July 2010 11:35:11 am

We have a single ez install for a client with 2 sites. Each site is on a seperate domain and is a child of the ez root node.

There is a third domain and siteacess for the 'admin'.

When content from site A links to content on site B the /siteB/ appears in the link url. This is a problem.

What is the recommended eZ publish solution for our scenario? Creating external links to jump between site A and Site B seems a very bad hack that doesn't leverage the settings and internal link smarts.

We are very concerned that linking to nodes across siteaccess don't resolve the urls. Do we have to get into the url_alias() kernel function and fix this to read the path-prefix to URL mapping? becuase that is where we are headed to solve this problem.

Are we just missing some obvious INI settings?

Any help is greatly appeciated as this effects deploying several client sites

Thanks

Peter Keung

Tuesday 27 July 2010 3:50:27 pm

There's no built-in eZ Publish solution. However, you could create a custom template operator that does string replaces for cross-siteaccess links. No hacking needed. I just wrote about this here: http://www.mugo.ca/Blog/ezpublish-cross-siteaccess-internal-links

If you don't want to read the post, here are the 3 main steps:

1. Create some INI setting mappings from the siteaccess path prefixes to their corresponding domain names

2. Create the operator

3. Override templates/content/datatype/view/ezxmltags/link.tpl to pass all eZ XML links through your custom operator before final processing with ezurl()

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Gaetano Giunta

Wednesday 28 July 2010 12:25:49 pm

Time for a feature request then? I kinda hoped that the switchlanguage module would have been able to do that...

Principal Consultant International Business
Member of the Community Project Board

Sander van den Akker

Tuesday 16 November 2010 8:24:33 am

*bump*

We ran into this problem today. Has this feature been requested yet? If not, I will do so.

An operator will do for the time being... but it should definitely be part of the kernel, or maybe a dedicated 'multi-site boilerplate' extension.

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

Duffy Walsh

Wednesday 06 April 2011 10:29:55 am

The template operator works great, but I wanted to add a question and see if there were any suggestions:

I have a default siteaccess set to:

'/'

and then three subsiteaccesses set to:

'/site1'
'/site2'
'/site3'

Unfortunately, my default siteaccess is not set up as /default, but rather is based off of /, as a result, linking between the three sub siteaccesses works fine when linking between the sub-siteacesses (site1, site2, site3), but anything in the default siteaccess does not not succeed in pulling out the subsiteaccess prefix...

I assume the reason for this is that the default siteaccess does not have a prefix with which to match pathURL in pathPrefixURLMap... any suggestions on how to solve this?

Duffy Walsh

Sander van den Akker

Wednesday 06 April 2011 12:15:38 pm

Try adding a prefix for the default siteaccess and set RemoveSiteAccessIfDefaultAccess to enabled. Does that fix your problem?

eZ Publish certified developer
http://auth.ez.no/certification/verify/392313

Duffy Walsh

Wednesday 06 April 2011 2:57:39 pm

Thanks for replying. I tired adding the PathPrefix to my default siteaccess and enabling the RemoveSiteAccessIfDefaultAccess as well.

Unfortunately, I had the same result. I didn't mention as well that the subsiteaccesses (site1, site2, and site3) all had their RootNodeDepth set to 2, and IndexPage and DefaultPage set to their respective Root Nodes. I'm not sure if this was affecting the custom template operator provided by mugo.ca. Regardless, in interest of getting this working, I moved away from using something like:
{$href|prefixurl()|ezurl()}

as suggested, and instead did something like this:

{def $clean_path = $node.path_identification_string|explode('_')|implode('-')}
...href="/{$clean-path}"...

obviously a hack, but appears to be working fine.

Duffy Walsh

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 18 2025 02:04:21
Script start
Timing: Jan 18 2025 02:04:21
Module start 'layout'
Timing: Jan 18 2025 02:04:21
Module start 'content'
Timing: Jan 18 2025 02:04:21
Module end 'content'
Timing: Jan 18 2025 02:04:21
Script end

Main resources:

Total runtime0.6881 sec
Peak memory usage4,096.0000 KB
Database Queries91

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0044 589.1328152.6250
Module start 'layout' 0.00450.0028 741.757839.4453
Module start 'content' 0.00730.6798 781.2031845.6875
Module end 'content' 0.68700.0011 1,626.890624.1563
Script end 0.6881  1,651.0469 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00280.4009160.0002
Check MTime0.00120.1695160.0001
Mysql Total
Database connection0.00060.093610.0006
Mysqli_queries0.603787.7386910.0066
Looping result0.00090.1377890.0000
Template Total0.663896.520.3319
Template load0.00170.251720.0009
Template processing0.662096.207720.3310
Template load and register function0.00010.013510.0001
states
state_id_array0.00080.121510.0008
state_identifier_array0.00070.095820.0003
Override
Cache load0.00160.2378720.0000
Sytem overhead
Fetch class attribute can translate value0.00070.107970.0001
Fetch class attribute name0.00130.1944170.0001
XML
Image XML parsing0.00360.526670.0005
class_abstraction
Instantiating content class attribute0.00000.0049210.0000
General
dbfile0.00210.3032480.0000
String conversion0.00000.001040.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
10content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
15content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 42
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs