Jump to content

php code inside .tpl file


zalafa

Recommended Posts

I've created custom page using custom controller point to custom tpl 

 

the code inside custom tpl "cek-resi.tpl"

<h1>Cek Resi Disini</h1>

{php} echo 'sdf'; {/php}

error logs http://zalafa.com/en/cekresi

Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "/home/zalafaco/public_html/themes/default-bootstrap/cek-resi.tpl" on line 3 "{php} echo 'sdf'; {/php}" unknown tag "php"' in /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php:667 Stack trace: #0 /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php(453): Smarty_Internal_TemplateCompilerBase->trigger_template_error('unknown tag "ph...', 3) #1 /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(2393): Smarty_Internal_TemplateCompilerBase->compileTag('php', Array) #2 /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3101): Smarty_Internal_Templateparser->yy_r37() #3 /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templateparser.php(3201): Smarty_Internal_Templateparser->yy_reduce(37) #4 /home/zalafaco/public_html/tools/smarty/sysplu in /home/zalafaco/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 667

what did i do wrong here? 

Link to comment
Share on other sites

Smarty doc. :

 

 

 This is for advanced users only, not normally needed and not recommended.

And the Prestashop doc:

 

 

  • Do not make direct PHP calls. For instance, do not use {php} // PHP code {/php}

Use the assign method to use variables or smarty functions.

A lot of Prestashop functions & methods can be used in tpl files...

 

Here, your echo function is useless, type directly: 

<h1>Cek Resi Disini</h1>

sdf
Edited by Eolia (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...