now the problem is that all the system functions work in the index.php file but when i call them from other files i get the Fatal error: Call to a member function on a non-object error. the files are included so they should inherit the class thats set in the index shouldnt they? could someone please tell me whats happening here and how to fix it? im new at OOP but i know php.
Well that error implies that you are trying to call a function of an object that is not a valid object. For instance
$p = new MyObject();
At a guess, I would say that the object is being instantiated in index.php (or a file included by index.php) and so therefore that file is working fine. However, in the other files (where you get an error), the error would suggest that you are not initialising an instance of the class, but rather, trying to access a function of a non existent class. I would ensure that the class is instantiated by looking back at index.php and it's included files, then ensuring you do the same on subsequent pages.
I see the problem here. As you are including the files in your class itself, you're correct in that it inherits it, but it retains its scope. Therefore, take header.php as our example, because it is being included in the getHeader() function it will be included correctly, but be classed as part of the class.
Thus, in header.php you can still call the functions in your Layout class, but instead of using the object itself that you created when initiating your class, in your example, $System->Layout, it would simply by $this.
<?php echo $System->Config->showSiteName();?>
<?php echo $this->showSiteName();?>
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.