• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter and Smarty

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:
{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?

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

The error is:
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

Can somebody help me?

Read the Smarty docs, that's why I linked them to you.

I have already read them, but it cannot include the php file from the views folder.

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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.