PDA

View Full Version : Double functions error!


jdleung
06-13-2006, 05:17 PM
I have 2 addons. One for image_template.html, another for browse_template.html. They both have a same function inside. this causes the archive

page goes to blank. And when I delete the function in the addon for browse_template.html, it goes well and even can use the function of the addon for image_template.html.

the function turns global?
Does it mean PP reads all the addon first no matter which page you're bruwsing and even no addon tag in it?

Will this slow down the speed?

refer to some other addons, I insert the following before the first addon's codes
1. if ($_GET['x']=='' ) { ...... }

can anyone give a clear answer on this?

Thanks.

jdleung
06-14-2006, 08:51 PM
no answer?
you guys watching football game?

Joe[y]
06-15-2006, 01:15 PM
yeah. i've got a bet on ecuador right now - going well. also got the england game later so no time to really take the time to understand this right now. will come back here.

jdleung
06-15-2006, 05:16 PM
3:0. you win!
hope you can give me a reply after England win the game.;-D

raminia
06-16-2006, 11:32 AM
I have your answer but you should hope that Iran won't lose too bad to Portugal tomorrow and then I'll give you the answer ;)

Ok... you did! now here is the answer

before defining the function put this line
if ( !function_exists('function_name') ){

and at the end add
}

for example

if ( !function_exists('my_function_name') )
{
function my_function_name(blah,blah,blah)
{
// do some good job out there
foo= ....;

// ... and return cool results ....

} // end of function

} // end of if function exit


Does it mean PP reads all the addon first no matter which page you're bruwsing and even no addon tag in it?

yes! all addons are included in the core index.php everytime! That's why you should be wise in writing addons and adding switches to turn them on when demanded. BTW, that's why we are considering the option to add workspaces to the front side as well as the admin side for the good of addon makers in future releases.

jdleung
06-16-2006, 07:07 PM
Thanks Raminia.
I'm clear now. hope pp will update soon.

I have your answer but you should hope that Iran won't lose too bad to Portugal tomorrow
I hope so. but... :p