This topic is locked

Adding a custom global function

9/23/2008 7:00:46 PM
PHPRunner General questions
B
bochaka author

I have created a custom function. I would like this function to be available to all my php project. I need to know where is the best place to place it.

Sergey Kornilov admin 9/23/2008

include/header.php is a good place

B
bochaka author 9/24/2008

Hi

My header.php file gets overwritten by the template header.php ever time i do a build.

S
steveh 9/24/2008

The other place is in the global events:
Add a global event, then close it off and create your one but don't close yours.
[codebox]

} // Close previous function
function myfunction($param)

{

echo $param;
// Note we don't close the function

[/codebox]

Sergey Kornilov admin 9/24/2008

You can remove header.php from templates' source directory.
You can also add your function directly to header.php located in templates' source directory.