Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter and Smarty
#1

[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?
#2

[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.f...de.php.tpl
#3

[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
#4

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

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

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

[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.




Theme © iAndrew 2016 - Forum software by © MyBB