Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Functions and include()

    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

  • #2
    Regular Coder
    Join Date
    Apr 2007
    Posts
    295
    Thanks
    0
    Thanked 19 Times in 19 Posts
    Declare the functions before the include

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well that was stupid, I thought I'd tried what you'd told me, but messed up a bracket. Figures, thanks though!

  • #4
    Regular Coder
    Join Date
    Apr 2007
    Posts
    295
    Thanks
    0
    Thanked 19 Times in 19 Posts
    Haha no problem, glad you got it working


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •