|
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 |
JayBeeDe Smarty n00b
Joined: 27 Oct 2016 Posts: 1
|
Posted: Thu Oct 27, 2016 10:26 am Post subject: [Smarty3] Settings when instantiating a Smarty object |
|
|
Hi,
I'm using Smarty 3 and it is working fine.
In my code I have to instantiate a lot of time some new smarty object.
For that I have to write each time:
[code] $smarty=new Smarty();
$smarty->force_compile=SMARTY_FORCE_COMPILE;
$smarty->template_dir=SMARTY_TEMPLATE;
$smarty->compile_dir=SMARTY_COMPILE;[/code]
How can I simplify this to:
[code]$smarty=new Smarty();[/code]
?
I have read the documentation, and seen a kind of configuration file but it seems not to be for that purpose. As smarty is a class, I don't want to change the content of the constructor.
Do you have an idea? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Oct 27, 2016 12:17 pm Post subject: |
|
|
http://php.net/OOP
Read that. The answer to your question is there, is clear and simple. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Oct 30, 2016 9:23 pm Post subject: |
|
|
Your code wouldn't work. Smarty::__construct() explicitly overwrites these values. |
|
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
|