Hi, Surely there's a wiki/doc somewhere :) But for the start: 1) plan what exactly you want to accomplish ( functionality ) 2) complexity - if simple, just throw it in one php ( like index.php ) - if more complex, you can separate the pages and/or use classes 3) based on 2), plan the structure ( I'm using mostly one entry point - index.php - with classes, templates, files included, since I like things separated ) Some thing you should not forget: - whole webapp thing is event based ( client will do something - press a link - and the server will react ) - the connection is not maintained all the time - PHP is server side (harder to debug), you cannot do anything on client side ( just push what to display ) ( JS is client side ) - you can start the session whenever you want ( it's nearly the first line of my app ), but you should control the access with variables, like if ( $_SESSION['uid'] ) or if ( $_SESSION['loggedin'] ) - most webservers interprets things between <?php ?> even if the file name ends with .htm or .html - for JS and connection related things FireBug for FireFox is a good idea ( you can track, what's submitted, etc ) What I'm liking: - one entry point ( index.php ) - sub-pages, are separate php/template pairs BUT are included from index.php ( after access verification, etc ) - nearly all the functions are put in separate classes ( like user.class.php for user related things - login,logout, etc ) - using a template engine is not a very bad idea ( like Smarty ), you can separate the real code from html, which make debugging easier - at least for me :) BTW, take a look on some free stuff. You can always learn from others. There are some good ideas in open CMS systems, like Joomla. Cheers, Tom -----Original Message----- From: Andreas [mailto:maps.on@xxxxxxx] Sent: Tuesday, August 16, 2011 12:39 AM To: php-general@xxxxxxxxxxxxx Subject: Newbie question. What is the best structure of a php-app? Hi, I'm fairly new to PHP but not to programming as such. Currently I sat up XAMPP with xdebug, Netbeans and Eclipse to get a feeling. I can write and run php-files but I am wondering how I should construct a more complex application that runs over several pages between a login and a logout. How would I structure such an application so that it is possible to run it in the debugger from the beginning? E.g. as a simple example I may build an index.html that has a menue with links to 3 php-files. 1) login.php 2) enter_data.php 3) list_data.php as html-links within an ul-list. The user should at first click on login where user/password gets entered an a session starts. Then the application comes back to index.html. Now he might click 2) ... Is it possible to run the whole application from the start on? index.html is no php so xdebug won't process it and therefore the IDEs may start index.html but can't show the stage where the page is just waiting e.g. for a click on "login" and later branch for the other options. Even if I write an index.php that shows the menue eventually the script just dumps the html that'll wait for the following clicks. Those following steps are far more likely in need to be debugged. Is it neccessary to debug those subpages separately even though they need prior steps like login.php that store some infos in a session or cookie that later scripts need to rely on? Can I somehow watch what is going on from the index.html on? Until now I just found documentation that explains the php language. Thats good too but I'd need to get an idea about the "web-app-thinking" that consist of just pages where the designer has to hope that the user stays within the applicationflow instead of clicking unexpectedly on the back-button or just jumping off to some other site if he likes to. In contrast to this desktop-apps seem to be less demanding because I know where a user can navigate from a certain stage within the app and I could step from program start to stop with the debugger if I feel the need to. Is there a tutorial that explains how to build consistent web-apps beyond the details of php language? regards... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php