Jump to content

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/63093-code-structure-frameworks/
Share on other sites

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.

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]

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.