As as an example, let's say I have a very basic template file being used, home1.php. home1.php includes this code:
<?php $this->loadBlock ('setup') ?>
In the blocks folder, I have a file called setup.php. In this file, let's say I just have some very simple PHP code, like
$x = 5;
But then in home1.php, if I do this:
echo $x;
It won't work, because home1.php doesn't have access to the variable $x from setup.php. The actual code is much more complex of course, but if I can figure out how to access PHP variables in blocks from the templates that call them, that would be very helpful. Or, maybe there is another way I should be doing this? I just don't like having 300 lines of PHP code at the beginning of my template file, but I don't see a way around it unless I can put it in a block. Do I just need to use the PHP require function to call an outside PHP file or something?
Thank you for any help.