| Main |

Using TSConfig to Ensure Dynamic Page Elements Are Always Up to Date

Category: Content Management with TYPO3

Wednesday, March 14, 2007

A common use for TypoScript (at least on my TYPO3 sites) is to dynamically generate lists and menus of other content items in the CMS, based on some set of criteria, and then insert these into a page.

For example, I might want to have a "5 most recent items posted to site section X" menu on my homepage.  With TypoScript, this is (reasonably) easy to do.

However, in some cases this can cause problems with TYPO3's internal caching mechanism.  TYPO3 caches content aggressively to minimize the load on the database of generating lots of pages -- which is exactly what it should do. But when you have pages that depend on the content of other parts of the site, you can run into problems where those pages don't update immediately when you alter the sections they're tied to, requiring you to empty the cache manually.

There is an easy way to avoid this, however. Just add the following command to the TSConfig of the page where you are adding the content items that are listed in your list/menu:

TCEMAIN.clearCacheCmd = <list of page-ids>

The value of this command should be a comma-separated list of all pages where your dynamic list appears. This command will automatically rebuild those pages whenever you add something to this page, which means users will always see the most up to date list.

Leave a comment


Recently on Just Well Mixed

Going Meta

Syndicate Me, Baby

Feed iconWeb feed

Share and Enjoy

Except where otherwise noted, all content on this site is provided under the terms of the Creative Commons Attribution-ShareAlike license.

Obligatory Disclaimer

If you think anything I write here represents the opinions of anybody but myself, you need more help than I can give you. The opinions are all mine, folks. Nobody else's.

If that's too hard to understand... well, I'm sorry. There's only so much I can do. I'm not a therapist, and I'm not a miracle worker. I wish I could help you work through your delusional belief that I'm speaking for anyone else but myself. Honestly, I do. But in the end, that's a monkey you'll have to get off your back on your own. Sorry.