Kemik Posted August 2, 2007 Share Posted August 2, 2007 Hello all, I've been researching ways people structure their code using different files. E.g. /functions/register.inc.php /functions/login.inc.php /includes/header.php /includes/footer.php index.php It's pretty clear OOP is the way to go but I'm just confused how the easiest and most maintainable way of structuring the code and files is. During my research I came across frameworks and I have been looking at PHPCake and CodeIgnitor. My questions are: 1. How do people structure their code? Could you give me an example or a tutorial please? 2. Would a large site which requires a large amount of code, such as a league script, be too much for a framework? 3. Which framework would work best with a league website? (e.g. best suiting included plugins) Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/63093-code-structure-frameworks/ Share on other sites More sharing options...
premiso Posted August 2, 2007 Share Posted August 2, 2007 What I recently started doing is having a directory called includes inside that have a classes directory and functions directory etc. Inside those I have files which I name func.main.php or class.db.php so I can have my data sorted easily. Using this you probably do not need the extra directory structure, but it can be nice. OOP is a good way to go if you are using PHP5 since PHP4 is limited use, it can be very frustrating. Frameworks can be nice, but really just sloppy and can make coding harder because half the time you have to re-code them to get them to do what you need. As far as a tutorial for structuring code, I do not think you will find one as it is really a personal preference for each person. As for the league, no clue. Hope that helps. Quote Link to comment https://forums.phpfreaks.com/topic/63093-code-structure-frameworks/#findComment-314277 Share on other sites More sharing options...
deadimp Posted August 2, 2007 Share Posted August 2, 2007 1. As for how sites are structured and all that, the best way to get into this is actually skim through a couple of frameworks and what not. There are different stylings, different methods, each with their pros/cons (organization, automation (locating/using plugins), aesthetics (simplicity), etc). I have my own simple framework as part of my CMS, Thacmus, which you can browse through (online via Source or downloading the code), but let me say that this is for more or less of a hobbyist. In theory it and every other system could handle a lot of content, and could be made more customizable, but then again, it's how easily it can handle the content / be customized that counts. A good place to look for PHP 5 software is the GoPHP5 website. Look into the frameworks listed there. 2. Frameworks are the low-level bases of the site, meant for core functionality. They should include the simple, heavily used pieces of the system, something like a database interface, parsing tools, user handling, etc. The focus should be how easily could you create a large piece of software, and how easily it can be maintained, depending on its own coding and the framework's. 3. What's a league script? [This probably belongs in the Desgin forum] Quote Link to comment https://forums.phpfreaks.com/topic/63093-code-structure-frameworks/#findComment-314280 Share on other sites More sharing options...
Kemik Posted August 2, 2007 Author Share Posted August 2, 2007 A league script is, just a websitethat I'm builing where users can sign up, create teams, join leagues, play matches and post their results. Quote Link to comment https://forums.phpfreaks.com/topic/63093-code-structure-frameworks/#findComment-314333 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.