This topic is locked

Adding an include on every page

12/1/2006 9:31:33 AM
PHPRunner General questions
kujox author

How can I add a include 'myfile.php' on every page with having to do it in visual editor. for every page

J
Jane 12/1/2006

Hi,
the easiest way to add myfile.php to the every page is to add the following code to the include/header.php file:

include("include/myfile.php");

kujox author 12/1/2006

Hi,

the easiest way to add myfile.php to the every page is to add the following code to the include/header.php file:


That doesn't seem to work for what I need, I don't think I was that clear about what I need.
I have a set of custom functions that are used by the php generated code and my custom code, they are in different directories. I want to be able to include my custom functions file in every _events page without adding it in every file.
I would rather keep my functions in one file so changes are easier, can you point me in the right direction

Sergey Kornilov admin 12/1/2006

Answer is the same - add a reference to include/header.php file. This will make your functions available in all events.

A
andrewpnlp 3/3/2009

Answer is the same - add a reference to include/header.php file. This will make your functions available in all events.


Hi Sergey,
Can I drag this one out of the history? I've just tried this with 5.0, and the function in header.php is not available within the custom values section as set in the visual editor.
Is there another way round this?
Regards,

Andy

A
andrewpnlp 3/3/2009



Hi Sergey,
Can I drag this one out of the history? I've just tried this with 5.0, and the function in header.php is not available within the custom values section as set in the visual editor.
Is there another way round this?
Regards,

Andy


Ah, think I might have cracked it
in c:\program files\phprunner5.0\source\include\commonfunctions.php
add a line like
include_once("your_custom_functions.php");
Then in your project folder, create the file your_custom_functions.php inside the include folder. And put all your functions in there.
That way, you can customise those files per project, and if you don't need it, you can just leave it empty.
Job done.
Regards,

Andy

kujox author 3/4/2009

I got round this by putting the include in the project events
in the after successful login function I put in the following

}
include 'my_include_function.php';
function dummy() {


I can then add any files I need to include here without have to edit the source files