Forum Moderators: coopster
I've been on a 2-year learning curve with PHP and now I feel fairly competent with most of the essential (and basic) aspects of the language. But I've never done a FULL php site - i.e. I have always created individual pages sprinkled with "as needed" php functionality.
This workflow takes me FOREVER - and I know it's unnecessary with php so I want to (have to) take the next step so I can develop client sites as rapidly and as effectively as possible using what I've learned.
I've heard that some developers just use a single php page (or template I guess you'd call it) for an entire site no matter how many actual "pages" are within the site. That's what I want to do! But I don't know the best "ground-up" stratgies to accomplish this task.
So, how do you folks do it? I mean is the first "best practices" step to create the DB? Do most people "include" headers and footers into thier main template? I've heard of "controller" pages that take a GET vars from an href which then feeds the proper content into the template...which is cool, but I don't know how to code such a page.
If there's a site that anyone can point me to, like "best php practices for rapid site/application development" that could teach me this stuff, that'd be great. I'm at a great educational disadvantage of being an expat living and working as a one-man-band in Southeast Asia. Accordingly, there are no "user groups" I can attend to this this information which is why WebmasterWorld - and all of the wonderful people on this list - have become my only means of real learning. For which, I must add over the past 2 years, that I AM HUGELY APPRECIATIVE!
So, how can I start this task? What are the very best, most efficient ways of doing what I desire to do?
Neophyte
1. Create your own framework:
I develop sites through my own framework. This includes DB structure, CMS and the site itself. I then top it off with OOP template system that makes the client's site unique. This is good for me 'cos I know the system through and through! You can do this, it's very rewarding but takes a long time to perfect everything!
2. Use someone else's framework:
There are LOADS of PHP frameworks out there! The best place I can suggest it this: [phpkitchen.com...] Try them out, see if you like them!
3. Use an open source CMS:
Now a OS CMS isn't the same as a framework. A CMS is all out of the box and you can just set up and go. A framework requires you to input some code to customise it, much like other types of frameworks (JS: Prototype; .NET and RoR).
The thing is, with each client, try something now. It's always a learning curve! And you should be taking advantage of people giving you projects for you to try new things and get paid at the same time!
Thats pretty much spot on. The main thing is to try and cut down on your coding time as much as possible, so write functions or classes for code you find yourself repeating. I structure all my sites with minimal templates, so if I have to make changes there isn`t too much to edit. Yes, I always use include files for headers and footers. Menu`s too. Why edit several pages when you can edit only one? I`m just starting a major revamp of one of my sites from tables to CSS. Its fun when you have something to work on.
So, neophyte, I think what you need is a little project for yourself. Maybe a personal site you have always wanted to build or something else? Nothing like hands on experience to help your learning. You have to start somewhere. As you are fairly comfortable with your PHP, it shouldn`t take you too long to grasp what other things you need for a dynamic site.
Good luck. And as always, any problems, you know where to ask.
dc
Thanks so much for your responses. Will try your suggestions. I am confused about what exactly a "framework" is? Is a framework like a template for pages, menus, etc that content is flowed into? Or is it like a like a "site controlling system" of some sort?
I looked at the link "php kitchen" link submitted but am a bit confused by all that is there.
Neophyte
For example, if you put some time out and create a full blown test web site where you have a CMS, a blog, a newsletter, etc... you then have a framework for a web site, so:
A client comes up to you and says, I want a CMS powered site. You then take the files you built (from your framework) and then build their site.
A framework is much like a skeleton for a web site! I hope that makes sense!
PHP Kitchen is good, I've used it before, but it's always best to see how it's done and do it yourself!
for a standard site, you basically have
- A menu (or 2)
- a title
- an area where the body text appears
- a footer
(very simply..)
You need to create a template that spits these things out onto the page, all you need to do is change the pretty bits on each site to move the core bits into different places and different colours.
The good thing about this style is that if the client wants a totally different page, you just build a second template for that function and you can re-use that again in future.