[Typo3] Cache / No cache

Matt Valenti mv at mattvalenti.com
Thu Jul 28 07:48:47 CEST 2005


I'm no expert but I've done this.  I have a page with the news plug-in.  The 
"no cache" option is not checked (i.e. I want the page to cache).  I have a 
template for that page only with the following line:

plugin.tt_news = USER_INT

I have the following in my main template:

# include the php script
includeLibs.displayFileLinks = 
fileadmin/scripts/user_itemMarkerArrayFunc.php
# call user function
plugin.tt_news.itemMarkerArrayFunc = user_Ratings

I wrote a function user_Ratings($markerArray, $conf) that increments the 
number of reads counter in the database.

What took me a while to figure out is how to only increment the read counter 
when somebody chooses to view the news item in single view.  Note that this 
function is called in list view for every news item too.

$row = $conf['parentObj']->local_cObj->data; // get the data array of the 
current news record
if ('SINGLE' == $conf['parentObj']->config['code'])

$row['uid'] will have the unique news id.

I hope that helps!

Best wishes,
Matt


"Hervé Inisan" <typo3 at self-access.com> wrote in message 
news:mailman.1090.1122467252.20617.typo3-english at lists.netfielders.de...
Hi list!

I'm not familiar with cache mechanisms and would like to know if this is
possible:
Let's say I have the tt_news extension (just an example; in fact I'm trying
to write my own ext.).
The news content can be cached as it doesn't change often.

But I would like to put a kind of click counter: each time a single news if
clicked, I would like to increment the counter (e.g. : this news was read
'n' times).

Is this compatible with the cache system?
Have you got any pointers or directions?

TIA,
-- Hervé Inisan.






More information about the TYPO3-english mailing list