Ideally i want to set custom params for caching in some particular nodes using conditions in my template.php

E.g. algorithm: for node with known nid set custom caching params

But that's enough for my purpose simply exclude from caching particular node. I fond this solution: Stop caching for a specific node type Drupal 7 this is exacly what im looking for but how i can change condition of checking from node type to nid.

I know about CacheExclude module, but for me unwanted to install module for just exclude one node for caching.

I'll be very grateful for helping me.

| improve this question | | | | |

A module with the below in it should stop caching on node 2. Change the number to do it on a different node id.

function MYMODULE_init(){
  if (arg(0) == 'node' && arg(1) == 2) {
| improve this answer | | | | |
  • arg() is evil. Using menu_get_object() to get/check the current node is a much better solution. – mpdonadio Sep 21 '14 at 20:54
  • why is arg() evil? I thought it would be better not to load a whole node just to check nid – 2pha Sep 22 '14 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.