CodeIgniter Forums
CodeIgniter and Smarty - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter and Smarty (/showthread.php?tid=52018)



CodeIgniter and Smarty - El Forum - 05-26-2012

[eluser]Dizaster[/eluser]
Hello,
I am using both CodeIgniter 2.1 and Smarty 3.1.8 but I need to solve a problem. I am trying to include a php file into a .tpl smarty file but I can't just get it to go. I am doing it like this:
Code:
{include file="header.tpl" title=Smarty}

{include_php file="views/welcome_message.php"}

{include file="footer.tpl"}
But it displays me an error. I need to load a php file from the views folder. Is there anyone can help me?


CodeIgniter and Smarty - El Forum - 05-26-2012

[eluser]Aken[/eluser]
What is the error?

include_php is deprecated in Smarty, you should probably use something else. http://www.smarty.net/docs/en/language.function.include.php.tpl


CodeIgniter and Smarty - El Forum - 05-26-2012

[eluser]Dizaster[/eluser]
The error is:
Code:
Fatal error: Uncaught exception 'SmartyException' with message '{include_php} is deprecated, use SmartyBC class to enable' in D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_compile_include_php.php:52 Stack trace: #0 D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(439): Smarty_Internal_Compile_Include_Php->compile(Array, Object(Smarty_Internal_SmartyTemplateCompiler), Array, NULL, NULL) #1 D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_templatecompilerbase.php(227): Smarty_Internal_TemplateCompilerBase->callTagCompiler('include_php', Array, Array) #2 D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_templateparser.php(2413): Smarty_Internal_TemplateCompilerBase->compileTag('include_php', Array) #3 D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_templateparser.php(3111): Smarty_Internal_Templateparser->yy_r3 in D:\xampp\htdocs\countdown\application\libraries\smarty\libs\sysplugins\smarty_internal_compile_include_php.php on line 52



CodeIgniter and Smarty - El Forum - 05-27-2012

[eluser]Dizaster[/eluser]
Can somebody help me?


CodeIgniter and Smarty - El Forum - 05-27-2012

[eluser]Aken[/eluser]
Read the Smarty docs, that's why I linked them to you.


CodeIgniter and Smarty - El Forum - 05-28-2012

[eluser]Dizaster[/eluser]
I have already read them, but it cannot include the php file from the views folder.


CodeIgniter and Smarty - El Forum - 05-28-2012

[eluser]Aken[/eluser]
Quote:IMPORTANT NOTICE
{include_php} is deprecated from Smarty, use registered plugins to properly insulate presentation from the application code. As of Smarty 3.1 the {include_php} tags are only available from SmartyBC.

That might be a good place to start looking.