Classes - Includes - and other issues

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NoReason
Forum Commoner
Posts: 51
Joined: Tue Sep 10, 2002 6:19 pm

Classes - Includes - and other issues

Post by NoReason »

Well i suppose its just one issue, and that is ...

Fatal error: Cannot instantiate non-existent class: sqlselect in /path/to/my/php/scripts/here/authme.php on line 5

Now im using an odd methodology in how im constructing my application, however this is the first time I have run into this problem.

My design is as follows;
index.php
Includes:
require('config.ini');
require($IncludePath.'sessionheader.php');
require($IncludePath.'html_header.php');
require($IncludePath.'classes.php');
|->require('layout_page.php');
| require($IncludePath.'html_footer');
|
| from the layout_page.php: (I will only include relevent info here)
| Includes:
|->include($ModulesPath.'accounts/authme.php');


Now if I use a class_exists() on the index.php after classes declaration I get an "OK!" , if I use classes_exists() on the layout_page.php include i get an "OK!", however if I use it on the authme.php include off the layout_page.php I get a FAIL!

Is there a maximum depth that declarations will carry over? I would not think so considerng the includes take effect before proccessing of the page occures....

Oh and yes, I have set the require() on index.php so i /know/ its finding the classes.php

help me? thanks :)
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Check your parantheses "}" and "{". Usually the error you get means that there is some error in the class.
NoReason
Forum Commoner
Posts: 51
Joined: Tue Sep 10, 2002 6:19 pm

nope

Post by NoReason »

No problems with the class i have tested them outside this application.

Upon further investigation however I am noticing that the $SCRIPT_PATH changes from /blah/index.php to /path/to/modules/runme.php when the page is /Submited/ wich makes sense since its that file that is now proccessing the requested script, but that should not make a differance I would not think... Would i loose control of the class in that case??

Do I have to redeclare the class on each page that proccess's its own script even though it is included into the index.php ..???
NoReason
Forum Commoner
Posts: 51
Joined: Tue Sep 10, 2002 6:19 pm

yup

Post by NoReason »

Yup, thats were it all goes to hell, as soon as I submit.. the page proccess independantly of the index.php, so has no idea of the requiers() or includes().... Which would mean that I would have to declare all includes on each new proccess....

What a pain in the ass,,,,,
Post Reply