Page 1 of 1

File does not get included

Posted: Thu Dec 21, 2006 12:38 pm
by amir
Hello,

I am working a project and this has different categories e.g. Development, Design, Hosting etc. I am using a main index.php on root and all the categories on the same folder where I have this main index.php. When a user clicks on any category, it calls index.php of that category. For example, if user clicks on a link/category hosting, it calls the index.php of that category. Its working fine for all other categories except one. Can anybody please give any idea why this is happening because these are on same level and I dont find any unusual thing in it.

TIA!

Posted: Thu Dec 21, 2006 1:19 pm
by volka
Use require() instead of include() , set error_reporting and display_errors to appropriate debug settings and print important variables/parameters just before decision are made depending on their values.

Posted: Thu Dec 21, 2006 2:25 pm
by amir
Thanks Volka!

I am using 'switch' for it. If query string has 'domain', display file of it, if query string has 'hosting', display file of it and so on. If no matches then display the default. After playing a bit with it, I just have come to know that switch does not display not only if there is no match but also if the matching file has some errors or warnings. Does it make any sense?

Please advise!

Thanks once again.

Posted: Thu Dec 21, 2006 2:31 pm
by volka
amir wrote:I just have come to know that switch does not display not only if there is no match but also if the matching file has some errors or warnings. Does it make any sense?
Honestly? No.
I guess you forgot to use break at the end of each case block and the other files have a die/exit statement somewhere in them.

Code: Select all

switch($yadda) {
	case 'abc':
		require 'abc/index.php';
		break;
	case 'xyz':
		require 'shalalalalu/index.php';
		break;
	default:
		require 'error.php';
		break;
}

Posted: Thu Dec 21, 2006 2:45 pm
by amir
I am using break in switch statement but I am not sure about CCS files as these are encrypted.

Thanks.

Posted: Thu Dec 21, 2006 3:22 pm
by volka
Then this shouldn't happen. But I cannot tell you where the error is from the information you've provided.