How to enable static html in php / smarty

I was prompted to include some html snippet in this php / smarty page. It's basically a sales agreement at the end of the overview page before you pay.

What is the code for including static html in my php / smarty template?

Thanks...

+2


a source to share


4 answers


Do you mean to include a file containing static HTML?

{include file="htmlfile.html"}

Strike>

change



Since the file is just HTML, it might be better to use {fetch}

like

{fetch file="path/to/html/file.html"}

      

For local files, either the complete system must be the file path or path relative to the executed php script.

+4


a source


Like any other templates, smarty files are HTML files. you can just paste your HTML into the smart template.



+2


a source


If you're trying to include code that contains javascript or similar, you can use {literal}{/literal}

tags to include a file, which you can use {include file="htmlfile.html"}

as Tom said.

+1


a source


Try this before displaying the template in your PHP file:

$smarty->assign('Sectionfile','section-name.html');
$smarty->display('template.tpl');

      

in the template itself:

{include file="html_dir/$Sectionfile"} 

      

+1


a source







All Articles