Hey,
Just out of curiosity I was wondering what method you guys like to use for website structure. This poll is purely for your own custom frameworks and not pre-built frameworks or CMS packages.
- Bootstrap: Individual PHP files for every page/method that are each include a "bootstrap" or "loader" file at the top that sets up database connections and/or templates. Example: mysite.com/index.php, mysite.com/forum.php, mysite.com/anotherpage.php
-Index Based Modules: All pages call or use mod rewrite to call an index.php file that then loads the correct module for the page from another PHP file along with initializing databases/templates etc. Example: mysite.com/index.php?module=forums (index.php will now call a function in forums_module.php) or using modrewrite mysite.com/module/forums
I personally have always used an OOP setup with Index based modules. However, I've seen a lot of people use the bootstrap method. Wordpress and vBulletin both use it too. I realize that you could probably optimize stuff a little bit better on a page by page basis with the bootstrap method but personally I think it sucks for development purposes.
Comments? I was kinda hoping this would lead to a discussion/debate about these two primary methods.
I just have one file filled with functions thats always included, and the actual page content is included on demand (?p=Trololo)
For instance, if I want to convert a userid into a name I have a function that does that.
I make a little bit of everything really;
* Portfolios
* Survey sites
* Social Networks
You probably consider this terrible practice, but I embed PHP within my HTML for echoing variables and drawing data pulled from a database.
I often create an includes folder and in there an all.php file, the all.php links to all the files I need generally, and so on.. I like module based coding.
Real men dont use frameworks
[QUOTE=supersnail11;26251957]Real men dont use frameworks[/QUOTE]
Mind explaining why you see things like that?
One thing I should add, if you could, let me know what kind of websites you normally develop.
I do all kinds of different websites from fantasy sports to ecommerce to social videos to a crazy pet dating website a client dreamed up.
I understand that for simpler websites and personal websites it's probably much easier to use either a single file for each page or just one base file that pulls in templates (like Fatal-Error suggested).
Out of curiosity, I'm also interested in how many PHP/HTML files you guys have for your base framework.
I use a complex module based system and a modified version of Smarty for serving up templates and keeping my PHP code from my HTML. Altogether the bare basic system is 3 PHP files with functions, 50+ custom PHP library classes for everything from Paypal integration to file reading, and then 2-15 PHP classes for each module
DAFK uses a fully custom framework, the core is around 5 files: database, helpers, caching, etc. It then has a few extra libraries, some written by myself. Everything from minifiers to API abstractions for various services.
Bootstrap usually because I cba to do any routing.
I just do whichever I feel like doing at that time :v:
In general, bootstrap, but I use index-based stuff on things that aren't very complicated, like some static pages :v:
Mixture of Bootstrap and index-based modules.
Index based is the way to go imo. I much prefer having a single entry point, although I'm currently making a switch to working with RoR instead of PHP.
[QUOTE=KmartSqrl;26257497]I much prefer having a single entry point, although I'm currently making a switch to working with RoR instead of PHP.[/QUOTE]
Any MVC framework like Rails or ASP.NET that uses an 'application' style approach, rather than page based (like in PHP) is similar to the index based approach in PHP, since all requests come into the framework's routing engine.
Bootstrap, with a whole metric ton of rewrite rules.
I have no idea how to call it, but it looks like Index Based Modules.
Core system, included on all pages (small, provides 'core' functionality). Then either bootstrap with mod_rewrite's, normally with load/ and templates/ folder.
Sorry, you need to Log In to post a reply to this thread.