I am trying to work with FatFree framework and trying to use the template engine. I am drawing a template with the following code -
echo Template::serve('template.php');
The problem I am facing is that inside the template.php file, F3 tags are recognized, but any PHP code does not work. For example, if I have the following code in the template.php file -
<?php if (F3::get('var') == 'var1') { ?> <span>var1 is present</span> <?php } else { ?> <span>var1 not present</span> <?php } ?>
Here, both var1 is present
and var1 not present
are printed regardless of the value of var. Also, php for loops doesn't work - so basically all of the PHP code doesn't work.
However, if I used <F3:check>
to write the above PHP code, then everything works fine. Can we use PHP code in templates. If so, this is a serious limitation.
source share