Sometimes, small WebBox-es with a single line, like this:
<WebBox ID="box_id">
<Include SRC="{{./}}{{file}}" />
</WebBox>
are used to include a file according to some condition.
Maybe it is better to use another more specific syntax, like this:
<FileSwitch ID="switch_id" FILE="{{...}}" />
In this case, the file 'switch_id.php' will contain the PHP code
that will actually decide which file is going to be included
(according to the state of the application). It will be something
like this:
<?php
class switch_id extends FileSwitch
{
function init() { . . . }
function switch() { . . . }
}
?>
where FileSwitch extends WebObject (so it may have state variables)
and the function switch() is called during the parse (similar to
function onParse() of the WebObject).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sometimes, small WebBox-es with a single line, like this:
<WebBox ID="box_id">
<Include SRC="{{./}}{{file}}" />
</WebBox>
are used to include a file according to some condition.
Maybe it is better to use another more specific syntax, like this:
<FileSwitch ID="switch_id" FILE="{{...}}" />
In this case, the file 'switch_id.php' will contain the PHP code
that will actually decide which file is going to be included
(according to the state of the application). It will be something
like this:
<?php
class switch_id extends FileSwitch
{
function init() { . . . }
function switch() { . . . }
}
?>
where FileSwitch extends WebObject (so it may have state variables)
and the function switch() is called during the parse (similar to
function onParse() of the WebObject).