...

View Full Version : Functions and include()



TheSambassador
06-04-2007, 12:32 AM
Hi all,

I've been wondering if there's a way to have a sort of "global functions" page.

Say index.php declares a bunch of functions, then selects a page with a GET variable, ie: "www.bla.com/index.php?p=yay" and includes that page with an "include" statement, like
$p = $_GET['p'].'.php';
include($p);

Now on the "yay" page, I'd like it to be able to access the functions declared in index, without declaring those functions on the "yay" page. Is this possible?

Thanks!

Sam

mr e
06-04-2007, 12:45 AM
Declare the functions before the include

TheSambassador
06-04-2007, 01:10 AM
Well that was stupid, I thought I'd tried what you'd told me, but messed up a bracket. Figures, thanks though!

mr e
06-04-2007, 02:29 AM
Haha no problem, glad you got it working



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum