This topic is locked

Include other functions

6/18/2007 4:00:57 AM
PHPRunner General questions
kujox author

Where can I place an include statement so it makes a set of functions available to any part of the application or place another function.
I used to place it in the events but this has changed in v4 as the functions are opened and closed automatically which means I am unable to place code before or after the function.
This used to allow me to keep functions within the project file.

Alexey admin 6/18/2007

Hi,
you can put your functions into Events tab the same way as you did it before.

Here is the example:

function LoginOnLoad()

{

------------------------------------

your code
}
function MyFunc1()

{

...

...

------------------------------------

}

D
daviesgh 6/18/2007

As every page includes dbcommon.php, and this includes the following: locale.php, events.php, commonfunctions.php, dbconnection.php, I just added my own php function file to be included after these. I realise that the functions are not contained within the project file, but if you have 20-30 custom functions, it is not so easy to maintain them within the PHPRunner Event Editor.
Gordon

kujox author 6/18/2007

Thanks Alexey,
I never thought of putting in a dummy function and putting the insert statement between them.

function LoginOnLoad()

{

------------------------------------

your code

}

insert '../myfunctions.php'
function dummyfunction()

{

...

...

------------------------------------

}


I didn't want to your solution Gordon as you have to keep putting the line back in after you have built the project, but cheers anyway