In drupal 6 I'm trying to execute a function on every page and output a different link based on what IP address someone is coming from. However, when I try this, it seems that the result is getting cached. I have tried this as a module and in template.php, but have not gotten results. What is the best approach to make sure this function executes on every page load? Or is there an easy way to create a template variable that does not get cached?
A:
Is it possible for you to use a block instead with BLOCK_NO_CACHE or BLOCK_CACHE_PER_USER as the block caching policy? If you put a block like this in a region above/below you could achieve a very similar effect on any page you like, node or otherwise.
hookd
2010-09-21 21:58:49
maybe, although the output I am trying to get is just a URL to stick in the header of my site. A block seems like it could be overkill, are there any caching policies one can set for template vars?
bkildow
2010-09-22 12:19:01
If you need the function to run on every page load, or just once per user, then the additional overhead of having a block is minimal, especially when you consider the ease of management using the blocks administration for visibility etc. Are you just using the built in caching functionality?
hookd
2010-09-23 22:00:00