Forums / Setup & design / Linking to nodes across siteaccess

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