Share a variable between default.php page template and a block view.php

Permalink
Hi there,
I have this code written in my page template
<?php
   $isOpen = false;
?>

When I try to access the "$isOpen" variable from one of my block view.php like this :
<?php if ($isOpen) { ?>
   Do some stuff
<?php } ?>

It doesn't work at all :(
Any ideas ??

 
Mnkras replied on at Permalink Reply
Mnkras
try using a global or a define
yukulelix replied on at Permalink Reply
Could you give more precisions please (an example would be really great), I still don't manage to make it work.
Thx for your answers ...
12345j replied on at Permalink Reply
12345j
use include() or require()
yukulelix replied on at Permalink Reply
What file do I include ?
Mnkras replied on at Permalink Best Answer Reply
Mnkras
do
global $isOpen = false;

then
above your if statement put

global $isOpen;
yukulelix replied on at Permalink Reply
Thx that worked I just had to write
global $isOpen;
$isOpen = false;

instead of
global $isOpen = false;