[TYPO3-ttnews] Get rid of relative URLs when generating RSS Feeds

Prakash spabhat at chandanweb.com
Fri Aug 7 17:47:20 CEST 2009


Hi,

In RSS generated using tt_news, I tried to convert all relative URLs to 
absolute URLs. I tried a solution for the same.

I used the general_stdWrap property of tt_news which applies stdWrap for 
body, shorttext and, links to add the URL prefix as follows:

 **********************************************************************
 Typoscript used is as follows:
 **********************************************************************
 [globalVar=GP:type=100]
 includeLibs.ttnewsabs = fileadmin/templates/absTypolink.php

   plugin.tt_news.general_stdWrap.parseFunc.tags.link.typolink >
   plugin.tt_news.general_stdWrap.parseFunc.tags.link.typolink.userFunc 
= user_typoLinkABS

 [global]

 **********************************************************************
 The Function user_typoLinkABS is as follows:
 **********************************************************************
 function user_typoLinkABS($content,$conf)    {

    $patterntoSearch = 
"([http])([ftp])([irc])([feed])([mailto])([javascript])";
    if( preg_match($pattern,$content['url']) == 0){
        $content['url'] = $GLOBALS['TSFE']->baseUrlWrap($content['url']);
        $content['TAG'] = '<a href="'.$content['url'].'" 
'.$content['targetParams'].' '.$content['aTagParams'].'>';
    }

    return $content['TAG'];
 }
 **********************************************************************

/*** THE Real BIG ISSUE ***/
I however found that the previous changes were not sufficient because we 
were using the DAM media tags in tt_news that are inserted through RTE, 
and they still had relative URLs.

I checked and found that this is generated using a DAM class and I added 
an XCLASS for the same.

This however seems a temporary fix, because as RTE is extended we may 
have to patch each of the related Extensions! Of course this is not 
feasible.
For example, I noticed that the Magic Images inserted using RTE still 
did not have the Absolute URLs!

I closely checked again, and found that when we use 
xmlnews.config.absRefPrefix, all the URLs do get the Absolute URL prefix 
as required but the RealURLs were not generated as desired.
Instead I got something like http://www.domain.com?id=12&params

To worsen the situation all news title had the domain name added twice like.
http://www.domain.com/http://www.domain.com/index.php?id=668&tx_ttnews[tt_news]=562&cHash=60de7afc2a

This seems quite complex than I had expected, and I am looking forward 
on how I can proceed on this.

What am I doing wrong? What is the best way to fix this issue? Anybody?

Thank you for reading and hope you would give a solution too  :-)

-- 
*Regards,
Prakash A Bhat*
Skype/Yahoo/GTalk/MSN: spabhat
Ph: +91 80 420 33 515
Mobile: +91 94481 40430
www.chandanweb.com <http://www.chandanweb.com>

Chandan Web Solutions <http://www.chandanweb.com> 
<http://www.chandanweb.com>


More information about the TYPO3-project-tt-news mailing list