Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By Sifro on
Hello,
in my html.tpl.php i have added a code like this at the very top to perform some actions when the user first enters the site (no need to do anything when the user continues his navigation)
if(!$_SESSION['var']) {
$_SESSION['var'] = true;
/* do some stuff... */
}
If I don't disable caching, the code above runs correctly the first time, but if i close my browser and re-enter the site, it never gets executed.
Any ideas to make it work without disabling caching?
EDIT: putting the code in the index.php file works fine also with caching enabled, but I'm on a Drupal Multisite install... so... any ideas to save both caching and multi-install environment? :D
Comments
Solved on stackexchange:
Solved on stackexchange: http://drupal.stackexchange.com/questions/88905/custom-php-code-before-a...