[TYPO3-core] RFC: #9046: Nested domain linking with domain record on root page

Tobias Liebig mail_typo3 at etobi.de
Mon Aug 31 22:35:24 CEST 2009


Hej,

sorry for being that late on this issue!

After some discussions we (at least Ingmar, Christopher, Dmitry and some 
more people during the T3DD) decided for the following solution:

* if the current page is part of the target pages rootline, the target 
page is reachable within the current domain and thus we do not need to 
prepend the domain to the link
* if not, step downwards the rootline of the *target page*
* search for the first domain record in the target rootline
* if this 'targetDomain' is not the same as the currently called 
HTTP_HOST, prepend the link with this domain

* the flag is_siteroot (oage properties) does not play here any role anymore


Additionaly we think it makes sense to be able to force a domain 
prepending (always prepend that domain). So i've added a 'forced' flag 
to sys_domain, and:

* search for a domain record which has the 'forced' flag within the 
target page rootline

So a subpage would be prepended with the 'forced' domain, even if the 
page would be available within the current domain. This is pretty 
helpful for independent subpages like in christophers example.


The attached patch implements this solution. It's created initially by 
Oli and discussed with Ingmar. Addionally i implemented the 'forced' 
flag in the domain record.



Known Issues:
* caching / domain name

The patch takes the current domain (HTTP_HOST) into account.
If a page is available by multiple domains, and is cached the solution 
may fail, if the page is delivered from cache.
So we need separate caches per HTTP_HOST, which can be achieved easily 
by adding the HTTP_HOST to teh cache identifier/hash
I'm not that into the caching mechanism, so someone need to help out.
If i remember right, Dmirty told he started to implement something like 
that for memcache caching.


* speed up by using a cache for sys_domains

currently we do a database query on sys_domains for *each* typolink on 
the page. I'm sure we can save some queries, if we memroize all records 
in an array (i think sys_domain would not contain many records usually).
But i'm not sure where to store that array. Any suggestions? (TSFE, GLOBALS)


Note:
i'm not sure, if this is a new feature (due to the forced flag in 
sys_domain), or more like an 'enhanced' bugfix

Note II:
Before we can commit this, we should solve the caching issue!
For testing and reviewing the patch, you may want to turn off caching.

regards
    tobias




Christopher Hlubek schrieb:
> Hi,
> 
> This is an SVN patch request.
> 
> Type: Bugfix
> 
> Branches: Trunk, TYPO3_4-2
> 
> Bugtracker references:
> http://bugs.typo3.org/view.php?id=9046
> 
> 
> Problem:
> 
> Consider the following setup with multiple domains:
> 
> + root (domain A, siteroot)
> |
> +--+ Subsite (domain B, siteroot)
> | |
> | +--+ Subpage
> |
> +--+ Some Page
> |
> +--+ Other Page
> 
> Even with typolinkEnableLinksAcrossDomains enabled, the links from the 
> subsite (domain B) back to some page on domain A won't get domain A 
> prepended.
> 
> 
> How to reproduce:
> 
> Create a site with a similar page structure and multiple, nested domain 
> records like above. Create a link from the inner domain to some page 
> with the outer domain -> The link doesn't get the outer domain prepended.
> 
> Solution:
> In class.tslib_content.php (5324) there is a check for every part in the 
> rootline, if the linked page shares a root page with the current page. 
> It does! The recently added check for is_siteroot is not considered, 
> because it is checked after this. So these checks should be swapped to 
> check for is_siteroot first and find the domain record on the root page.
> 
> Additionally there should be another tweak to not always include the 
> domain for pages that link between the outer domain (which will always 
> be found). This could be accomplished by comparing the HTTP_HOST with 
> the domain that should be prepended.
> 
> 
> Thanks
> Christopher



More information about the TYPO3-team-core mailing list