[TYPO3-ttnews] linking single news record from own extension (cHash)

Martin Clewing mpc at clewing.de
Mon Jul 17 15:39:52 CEST 2006


Ernesto Baschny [cron IT] schrieb:
> Martin Clewing schrieb am 11.07.2006 10:14:
> 
> 
>>I stumbled over a little (hopefully) problem: how can I link a single
>>news from within an extension?
>>
>>I managed to link a news-entry when I disable cashing, but (of course) I
>>need caching for indexed search, so this is no option.
>>
>>In other words: how do I create the cHash? Is there any way to do that
>>at all? I looked into the tt_news extension, hoping to find the clue,
>>but it's slightly beyond my horizon... which fields go into PiVars?
>>
>>The solution I found in this list (posted a year ago) was this:
>>including a link-field in my extension where the news-articles url is
>>inserted. That is not as comfortable as I would like it to be AND
>>excludes any hide/timestamp/archive-functionality, which is really a
>>great loss.
>>
>>Any ideas/help/solutions maybe?
> 
> 
> You should use the "typolink" function to create the link. Just pass it
> the correct $conf:
> - parameter: the page-id where to display the single news
> - additionalParams: the parameters just like tt_news does it
> - and: useCacheHash=TRUE so it will generate the corresponding cHash.
> 
> Note that you need to use the exact same parameters as tt_news, else the
> cHash will differ.
> 
> Documentation for the typolink function:
> 
> http://typo3.org/documentation/document-library/references/doc_core_tsref/current/view/5/8/
> 
> Call it through a valid cObj.

Thanks, Ernesto,

that's the theory behind as far as I understood. The only problem now 
is: how exactly do I do that? Like I wrote: it's slightly beyond my 
horizon. Are there any examples somewhere? tt_news itself is slightly 
too complicated to unveal it's secrets to me :-(

this is as fas as I got, displaying the headline, date, etc,...:

------------------------
if ($this->internal['currentRow']['rel_news']!=''){
// split list od related news
foreach(explode(",",$this->internal['currentRow']['rel_news']) as $k => $i){
$res = 
$GLOBALS["TYPO3_DB"]->exec_SELECTquery("title,datetime,short,tx_mpcnewsext_place","tt_news","1 
AND tt_news.uid = '".$i."' AND tt_news.deleted!='1' AND 
tt_news.hidden!='1'");
while($row = mysql_fetch_assoc($res)) {
$news.="<b>".$row["title"]."</b><br />".strftime('%A, %e. %B 
%Y',$row["datetime"]).", ".$row["tx_mpcnewsext_place"]."<br 
/>".$row["short"]."<br /><br />";
                  }
}
}
return "<b>related news:</b><br />".$news;

-----------------------

tx_mpcnewsext_place is an additional field inserted by my extension.

Any help would be apprecciated.
Thanks,
Martin



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