[TYPO3] HowTo: Ratings for tt_news

Fabian Koenig koenig at bluhouse.de
Wed May 16 15:53:18 CEST 2007


Okay, I get it :-)

There is a HowTo available to use tt_rating with tt_news:
http://www.typo3.net/forum/list/list_post//49619/


It's german, so here is an (bad-)english translation:

1. Install the rating-extension

2. Include static from extension -> tt_rating

3. Insert TypoScript:
#create the link to the current page used to submit the rating data
plugin.tx_ttrating_pi1.voteform.type = TEXT
plugin.tx_ttrating_pi1.voteform.type.data = getIndpEnv:TYPO3_REQUEST_URL

# Create Content Object correctly linked to tt_news
temp.rating = COA_INT
temp.rating {

         10 = LOAD_REGISTER
         10.tt_news_uid.field = uid
         10.tt_news_uid.table = tt_news

         20 < plugin.tx_ttrating_pi1
         20.rateTable = tt_news
         20.rateTableUid.data = register : tt_news_uid
}
#Add the rating form after the title
plugin.tt_news.displaySingle.title_stdWrap {
         postCObject < temp.rating
         innerWrap = <h1>|</h1>
}

4. Edit the plugin-class-file:
~line 102 -> DON'T comment out the "createNewItem" line
$items[] = $this->createNewItem($pid, 
$this->rateTable.'_'.$this->rateTableUid);

~line 135 -> Insert a cookie-check "if user still rate"
if (!$GLOBALS['register']['tx_ttrating'][$item['uid']]['submittedRating']
AND !isset($GLOBALS['HTTP_COOKIE_VARS'][$cookieName])) {

~line 282 -> Insert $recordLink in createNewItem() and outline unused lines
function createNewItem($pid=0,$recordLink) {
$pid = $pid ? $pid : $GLOBALS['TSFE']->id;
//$recordLink = '';
//if ($this->rateTable AND $this->rateTableUid) {
// $recordLink = $this->rateTable .':'. $this->rateTableUid;
//}


That's all.
I hope you can understand me :-)


Fabian


More information about the TYPO3-english mailing list