Is there a way to prevent PHP code from executing during the Cron Job?

Whenever I create a Page using the PHP Filter, the PHP code that I place on the page gets executed during the Cron Job. Is there an API call or some other code that I can call or wrap around the PHP code to prevent it from executing during the Cron?

Thanks for any insights.

Steve

Comments

coreyp_1’s picture

you could use an if statement like this:

if (arg(0) == 'node' && is_numeric(arg(1))) {
  //this is the actual node page, do the php...

}

- Corey

sciman’s picture

Hi Corey,

Not quite sure what it is supposed to do, but I'll give it a try and see how it goes.

Thanks,

Steve

coreyp_1’s picture

Basically, it makes sure that the PHP is only executed when you are looking at a node page (ex. www.example.com/node/7). arg() is a drupal function that lets you know the parts of the url that determine what page to show.

- Corey