Ok so I am trying something pretty simple. I want to use external templates.
I have created a super simple snippet that goes like this:
$a = include ’assets/templates/test.html’
return $a;
I keep getting the random number 1 inserted. If I echo the include instead like this
echo include ’assets/templates/test.html’
then there is no number 1 inserted.
Just to be sure I wiped out my install, re-installed a vanilla install and did nothing other than create this one snippet and call it in the base template created on install. I also recreated my html file to include nothing other than a h1 tag with some test text.
What is going on here? Banging my head against the wall!
-
☆ A M B ☆
- 24,524 Posts
Consider what include is actually returning into your variable. Include is not a function, it is a directive. It includes the specified file, and returns 1 for success or 0 for failure.
So you would do this
include 'file.php';
return;