Hi, while browsing my forum (phpbb) code, I was confused as to how all of the custom functions, variables, etc. are available to every single page in the forums software without any linking between the pages.
I know that sounds confusing, I'm a little tired. This example will clarify what i mean:
Code from the index.php page (starts from the beginning)
<?php
// comments removed for sake of brevity
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
...
the snippet with session_pagestart:
note: located at '/functions/sessions.php'
function session_pagestart($user_ip, $thispage_id)
{
global $db, $lang, $board_config;
global $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $SID;
....
So, how do they do that without any kind of code linking the two pages? Does the server know that all the files are linked somehow and can just call functions from another page on the site?
E.g., if i had one page named "functions.php" with a function called "superfunction" and another page called "index.php", could i just use superfunction in my index.php page without having any reference in index.php TO functions.php??
Thanks alot in advance, this is kind of a long, confusing post, but I would really appreciate any insight you can give me to the matter.
~will