Here's my solution:
Index.php:
// 1. First, we manage the session
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// 2. We store the session variable
$_SESSION['provenance_album'] = 'fromIndex';
// 3. Finally, we include the header
include_once('header.php');
And search.php:
if (session_status() == PHP_SESSION_NONE) { session_start(); }
$albumencours = isset($_SESSION['provenance_album']) ? $_SESSION['provenance_album'] : 'Default';
include_once('header.php');
// Definition of exclusion according to the current album
if ($current album == "fromVR") {
$_REQUEST['excludealbums'] = 'Themes,Animus,Backend-Audio,BP,Demos,Simalateur-A1,Tests,illusions,Grand-Piano';
} else {
$_REQUEST['excludealbums'] = 'VR,Animus,Backend-Audio,BP,Demos,Simalateur-A1,Tests,illusions,Grand-Piano';
}
$_zp_current_search = new SearchEngine();
Finally, album-vr.php:
if (session_status() == PHP_SESSION_NONE) { session_start(); }
// force UTF-8 Ø
if (!defined('WEBPATH')) {
die();
}
// We store the name of the current album folder
$_SESSION['provenance_album'] = 'depuisVR';
?>
This way, I can perform as many searches as there are use cases across different areas of my site, including individual pages!