sennetta Posted December 22, 2007 Share Posted December 22, 2007 I have a site which has one point of access for the end user: the "index.php" in the public_html dir. Other pages are included by reference in this page: "index.php?p=news" My question is should I place these included pages in a web accessible dir (below public_html), or should I place them above? Also where should I put any class files I use? If I put them above the public_html dir will it cause any problems? Cheers, Anthony Quote Link to comment https://forums.phpfreaks.com/topic/82777-solved-where-do-you-place-class-libraries/ Share on other sites More sharing options...
trq Posted December 22, 2007 Share Posted December 22, 2007 If all your pages are accessed via the one index.php page there really is no reason to have any other files within your public_html dir accepting any css, javascript or images. Quote Link to comment https://forums.phpfreaks.com/topic/82777-solved-where-do-you-place-class-libraries/#findComment-421021 Share on other sites More sharing options...
Daniel0 Posted December 22, 2007 Share Posted December 22, 2007 Also where should I put any class files I use? I do this: <?php // LIB_PATH being defined to hold the path to the library folder function __autoload($class) { $path = LIB_PATH . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php'; if(file_exists($path)) { require $path; } } ?> In that way I don't have to include any class files. Database would be in /path/to/lib/Database.php, Database_MySQL would be in /path/to/lib/Database/MySQL.php etc. Quote Link to comment https://forums.phpfreaks.com/topic/82777-solved-where-do-you-place-class-libraries/#findComment-421173 Share on other sites More sharing options...
sennetta Posted December 23, 2007 Author Share Posted December 23, 2007 Ah nice one. I'll stick it all above the web-accessible dir to avoid fannying around with permissions. Cheers. Quote Link to comment https://forums.phpfreaks.com/topic/82777-solved-where-do-you-place-class-libraries/#findComment-421919 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.