Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

how can I understand if a function has been called?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
nico654
Smarty Rookie


Joined: 22 Apr 2004
Posts: 5

PostPosted: Wed May 05, 2004 11:47 am    Post subject: how can I understand if a function has been called? Reply with quote

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 Smile

Thank you
Back to top
View user's profile Send private message
Hinrich
Smarty Rookie


Joined: 18 Apr 2003
Posts: 33

PostPosted: Wed May 05, 2004 6:15 pm    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed May 05, 2004 6:53 pm    Post subject: Reply with quote

you say "A preloads some info". maybe you just have to check inside B if this preloaded info is available?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
zayhen
Smarty n00b


Joined: 13 Dec 2004
Posts: 4

PostPosted: Mon Dec 13, 2004 11:17 pm    Post subject: What about a class Reply with quote

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
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP