View previous topic :: View next topic |
Author |
Message |
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Mar 12, 2015 3:42 pm Post subject: |
|
|
Write smarty plugin instead. |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Thu Mar 12, 2015 4:52 pm Post subject: |
|
|
AnrDaemon one question ???
when cache is false, smarty function define in global scope and you can access to smarty function in any scope but when cache is set to true this action does not work correctly.
why ?
you can test above example in post 1 by two way:
one) $smarty->caching = false;//worked
two) $smarty->caching = true;//does not work correctly |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 14, 2015 5:09 am Post subject: |
|
|
Do you run the latest Smarty version 3.1.21?
{call ,,,, nocache} did have some problems in earlier versions. |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 14, 2015 11:21 am Post subject: |
|
|
One general note:
Template functions are always globally defined, normally regard less if the definition is in the main or a sub template.
Your problem was caused again by your modification of your special {require} tag for variable template names.
Smarty was not able to resolve nocache calls of template function which are defined in subtemplate with their own cache file.
The fix is on github and will later be included in 3.1.22 |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Sat Mar 14, 2015 1:09 pm Post subject: |
|
|
U.Tews wrote: | One general note:
Template functions are always globally defined, normally regard less if the definition is in the main or a sub template.
Your problem was caused again by your modification of your special {require} tag for variable template names.
Smarty was not able to resolve nocache calls of template function which are defined in subtemplate with their own cache file.
The fix is on github and will later be included in 3.1.22 |
thanks.
but yet this problem is exists in another type :
last bug is fix ok. but see example :
before test this example remove any compile or cache file in smarty
test :
Code: | {$a = 'ok' nocache} |
%main% :
Code: | {require 'test'}
{$a nocache} |
output : ok
no problem up here.
but now replace above template with (no remove any compile file or cache file)
test :
Code: | {function name=func}
{nocache}loaded{/nocache}
{/function} |
%main% :
Code: | {require 'test'}
{call name=func nocache} |
output : Unable to find template function 'func' |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sat Mar 14, 2015 1:51 pm Post subject: |
|
|
What is your compile_check setting?
Does mysql have correct timestamp corresponding to the timestamps of the file system?
Did you make your changes with the correct user_ID ß
iT DOES WORK HERE: |
|
Back to top |
|
sm@rty Smarty Regular
Joined: 01 Oct 2014 Posts: 65
|
Posted: Sat Mar 14, 2015 7:04 pm Post subject: |
|
|
Quote: | What is your compile_check setting? |
is default setting.
Quote: | Does mysql have correct timestamp corresponding to the timestamps of the file system? |
i always using php timestamp and not using mysql server timestamp.
In addition, timestamp in php and mysql is same.
Quote: | Did you make your changes with the correct user_ID ß |
yes
in above example :
in first run status of compile and cache
http://wikisend.com/download/609390/run 1.zip
in second run(when run give error Unable to find template function 'func')
http://wikisend.com/download/429150/run 2.zip
in third run (does work) status of compile and cache
http://wikisend.com/download/491700/run 3.zip
run == refresh page
if you think problem is in timestamp please see the example below :
%main%
Code: | {require 'test'}
{$a nocache} |
test
output : 1
now i updating template test to :
output : 2
so no problem in timestamp. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Mar 15, 2015 1:11 am Post subject: |
|
|
Smarty did internally restore the compile_check status too late during update of the first cache file.
This fixed now. |
|
Back to top |
|
|