[TYPO3-dev] Mapping eId-URLs to "real" URLs

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Fri Jan 19 22:14:37 CET 2007


Ernesto Baschny [cron IT] schrieb:
> Martin Kutschker wrote: on 18.01.2007 16:13:
> 
>> I wanted to translate all of my URLs to fake "real" URLs. Why? So I can
>> get a complete dump with wget easily.
>>
>> But the dump should include also the click enlarge images provided by
>> showpic.php which as of 4.0 is implemented as a eId-URL.
>>
>> Does anyone have an idea how to get this into Real URL?
>>
>> I think of having the eIds in a separate URL prefix, eg mysite.com/eid/.
>> So mysite.com/eid/showpic/options should be the generated and accepted
>> URL for my popups.
>>
>> The other thing I need to change is the thumbnails. Currently they are
>> done as t3lib/thumbs.php, but if they were an eId-script they too could
>> be set up like above.
> 
> You need:
> 
> 1) the link generation should go through typolink so that a RealURL can
> be generated at the first place. Currently cObj::imageLinkWrap creates
> the URL manually:
> 
> $url =
> $GLOBALS['TSFE']->absRefPrefix.'index.php?eID=tx_cms_showpic&file='.rawurlencode($imageFile).$params;
> ...
> 
> I think this is not such a difficult task to change that to a call to
> typoLink (or linkdata).

I was aware of that.

> 2) the whole purpose of eID is that you don't need to load anything from
> TYPO3 framework that you don't specifically need. If you want to be
> "realurl aware", the eID routine needs at least to be able to load the
> realURL configuration, which means to load ext_localconf.php.

I think I have my made my point now that I want this feature only for 
specific eID-scripts. ie those whose author cares to call a the future 
get-params-from-path-function (with a hook for RealURL and other 
extensions) in class.t3lib_eidtools.php.

> Apart from that you need to tell RealURL that there are URLs that are
> not bound to "page IDs", which is currently central for realurl
> functionality (generation of page-path with the "pagePath" function).
> 
> An idea would be to allow an alternative pagePage in case no page is
> being processed. I think the most difficult issue here is to make sure
> it don't break any existing sites (e.g. which already have a page called
> "eid" on first level). Maybe it already works if you use preVars for
> that purpose, but in case of variable amount of parameters you have the
> problem that preVars expect a fixed amount of parameters.

I though about extending Real URL in such a way a that a special preVars 
prefix is reserved for eIDs. Eg

mysite.com/some/path
mysite.com/de/some/path
mysite.com/en/some/other/path
mysite.com/script/showpic/file/params
mysite.com/script/thumbs/file/hash

If all eID scripts are within /script I think the setup is fairly safe. 
You must only take care not to name a page "script", that's all.

> You also have to make sure no part of realurl is called that expect some
> part of TYPO3 to be loaded which we don't load in our eID-script.

You mean, I could run into a situation where an object needed by Real 
URL has not been instantiated by my script? Right, but I hope it's only 
the DB connection which is not to expensive.

Masi




More information about the TYPO3-dev mailing list