|
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 |
nico654 Smarty Rookie
Joined: 22 Apr 2004 Posts: 5
|
Posted: Wed May 05, 2004 11:47 am Post subject: how can I understand if a function has been called? |
|
|
Inside a plugin function (B) I need to verify if the user has called another plugin function (A) before calling it (B). This because the function A preloads some info for the function B.
How can I verify, inside B, if A has been called before B?
Hope to be clear
Thank you |
|
Back to top |
|
Hinrich Smarty Rookie
Joined: 18 Apr 2003 Posts: 33
|
Posted: Wed May 05, 2004 6:15 pm Post subject: |
|
|
Declare a status variable in function A as static variable. Then set it on the first call and call function A anyway. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed May 05, 2004 6:53 pm Post subject: |
|
|
you say "A preloads some info". maybe you just have to check inside B if this preloaded info is available? |
|
Back to top |
|
zayhen Smarty n00b
Joined: 13 Dec 2004 Posts: 4
|
Posted: Mon Dec 13, 2004 11:17 pm Post subject: What about a class |
|
|
If i understood you have something just like:
function A( $var)
{
//does something with $some_var
//to set it properly to usse in B
B($some_var)
}
Try it:
class foo {
var $state;
function A()
{
//sets $state
}
function B()
{
if ($this->state isnt properly set) exit
else does something with state
}
} _________________ Stay cool to stay alive!!!
http://www.cliqueaqui.com.br
webdesign, webdevelopment, web everything!!! |
|
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
|