[TYPO3] Cached output, but need to increase field in DB
R. van Twisk
typo3 at rvt.dds.nl
Tue Apr 3 02:32:40 CEST 2007
Matthias Stuebner wrote:
> On Mon, 02 Apr 2007 16:54:08 +0200, Ernesto Baschny [cron IT] wrote:
>
>
>> Yes, USER_INT is the key here to the solution. The page will remain
>> "cached", only your counter will be called on each hit. Has the
>> disadvantage that TYPO3 needs to load its framework on every hit, but at
>> least it just will need to render your USER_INT output and not the whole
>> page.
>>
>
> Yes/No. The thing why I don't "want" to believe that this is the only
> solution is, that the USER_INT would output anything but would take care
> that the code that increments the counter in the db is executed.
>
> The negative sideeffect is that the editor of that site has to add a second
> content element just for counting. I still hope that there is an easier
> solution and an automatic one (that doesn't need a second element to be
> created). Am I wrong?
>
Use a hook,
every time a page get's outputted it can call a hook,
I use this hook: contentPostProc_output
Then in that hook do a simple update of your page counters,
for example:
update pages set counterfield=counterfield+1 where uid=<someuid>
Then your page will alsways be in cache,
but you can update your statistics.
Ries
More information about the TYPO3-english
mailing list