|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
Meganathan Smarty n00b
Joined: 18 May 2012 Posts: 1
|
Posted: Fri May 18, 2012 9:15 am Post subject: smarty with php |
|
|
Hi,
I've a problem when use following code in smarty file(.tpl):
{php}
echo "hi";
{/php}
please reply what is problem here |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri May 18, 2012 10:13 am Post subject: |
|
|
The {php} tag is in Smarty 3 deprecated for security reasions.
If you really need it use the SmartyBC class. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Oct 10, 2012 5:00 pm Post subject: |
|
|
Include SamrtyBC.class.php instead of Smarty.class.php and create the Smarty instance with $smarty = new SmartyBC; |
|
Back to top |
|
Izabella Smarty n00b
Joined: 03 Apr 2013 Posts: 1
|
Posted: Wed Apr 03, 2013 1:48 am Post subject: |
|
|
I also have a similar issue.
My problem is that I need to insert a php file into header.tpl with {include_php} but I receive the error code:
Fatal error: Uncaught exception 'SmartyException' with message '{include_php} is deprecated, use SmartyBC class to enable
I know that I should use SmartyBC, but the problem is that the software is fully encoded, so I am not able to change anything. Only 1 .php file "config.php" is not encoded, which includes the database login details. The software using Smarty v. 3.1.12.
My question would be is there any alternate way to fix the issue? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Apr 03, 2013 2:18 am Post subject: |
|
|
Izabella wrote: | I also have a similar issue.
My problem is that I need to insert a php file into header.tpl with {include_php} but I receive the error code:
Fatal error: Uncaught exception 'SmartyException' with message '{include_php} is deprecated, use SmartyBC class to enable
I know that I should use SmartyBC, but the problem is that the software is fully encoded, so I am not able to change anything. Only 1 .php file "config.php" is not encoded, which includes the database login details. The software using Smarty v. 3.1.12.
My question would be is there any alternate way to fix the issue? |
If you are using software that is encoding the Smarty libraries, they are using it against the LGPL license. You might inform them they need to leave the Smarty libs unencoded.
To answer your question, don't try to embed PHP in templates. Use template functions to fulfill your task. There is a reason Smarty 3 deprecated php in templates, it is always a bad idea and there is always a better way. Also, find another software vendor that doesn't encode source.
I hate encoded software, it solves a problem in completely the wrong way. It makes the software completely unmaintainable and a PITA. They will eventually learn that it works best to protect software with licenses, not with encoding. That is, if their software doesn't completely fail to succeed first because of it. Maybe they'll realize no one wants to copy their software anyways. /end rant |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|