View previous topic :: View next topic |
Author |
Message |
pedrotester Smarty Regular
Joined: 06 Jun 2019 Posts: 40
|
Posted: Fri Aug 16, 2019 9:33 pm Post subject: I can't find the function setCaching() anywhere in my Smarty |
|
|
Hello,
I have enabled caching with setCaching and it works fine but when I check in my files, I can't find anything related to that method/function (with grep). I'm a beginner in PHP so I really don't understand why/how.
Maybe the function name is dynamically formed?
Can someone enlighten me? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Aug 21, 2019 8:21 am Post subject: |
|
|
What name/function you are referring to? |
|
Back to top |
|
pedrotester Smarty Regular
Joined: 06 Jun 2019 Posts: 40
|
Posted: Wed Aug 21, 2019 5:52 pm Post subject: |
|
|
Quote: | $smarty->setCaching(Smarty::CACHING_LIFETIME_CURRENT); |
As written here: https://www.smarty.net/docs/en/caching.tpl
I can find "caching" but not "setCaching" however both enable caching, so i'm just confused |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Aug 22, 2019 4:58 am Post subject: |
|
|
Use setCaching()
And yes, these are dynamically inserted. |
|
Back to top |
|
pedrotester Smarty Regular
Joined: 06 Jun 2019 Posts: 40
|
Posted: Sat Sep 21, 2019 9:01 pm Post subject: |
|
|
(i had no internet for a while and forgot this)
So you mean that "setCaching" is not present in the files, because the word "setCaching" is dynamically created?
Because I don't find the word "setCaching" at all in my files, yet it works. (Sorry to repeat but I want to be sure) |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sat Sep 21, 2019 11:07 pm Post subject: |
|
|
In Smarty 3.1.33, in the file /sysplugins/smarty_internal_templatebase.php, at line 358, I found setCaching($caching). |
|
Back to top |
|
pedrotester Smarty Regular
Joined: 06 Jun 2019 Posts: 40
|
Posted: Mon Nov 04, 2019 5:46 pm Post subject: |
|
|
bsmither wrote: | In Smarty 3.1.33, in the file /sysplugins/smarty_internal_templatebase.php, at line 358, I found setCaching($caching). |
In "Smarty.class.php" I have this:
Code: | const SMARTY_VERSION = 'Smarty-3.1.8'; |
Now in "sysplugins/smarty_internal_templatebase.php", I don't have any "setCaching", but at line 352-360, this:
Code: |
} else {
if ($merge_tpl_vars) {
// restore local variables
$_template->tpl_vars = $save_tpl_vars;
$_template->config_vars = $save_config_vars;
}
// return fetched content
return $_output;
}
|
Weird, no??? Or it has been added a few minor versions later?
Note: i wouldn't know how to update Smarty without breaking stuff (or how to check what has been broken) |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Nov 06, 2019 10:11 pm Post subject: |
|
|
All Smarty properties can be accessed by corresponding getter/setter functions. However depending of the release not all of these functions had been implemented in real code but the generic __call interface |
|
Back to top |
|
pedrotester Smarty Regular
Joined: 06 Jun 2019 Posts: 40
|
Posted: Fri Nov 29, 2019 11:32 pm Post subject: |
|
|
alright still no idea how it can work while not being in the code |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sun Dec 01, 2019 10:17 pm Post subject: |
|
|
pedrotester wrote: | alright still no idea how it can work while not being in the code |
Through MAGIC! |
|
Back to top |
|
|