Tag Archives: framework

Bootstrap Doesn’t Have to Look Like Bootstrap

Since Twitter released their Bootstrap CSS framework, there has been some backlash among web designers. It tends to be used fresh out of the proverbial box, without any modification, an awful lot. The snide remarks about Bootstrap are largely unfounded, though. While some people may simply keep all of the defaults and use it to throw something together quickly, it is still a framework like any other. It offers an excellent array of features you might want in a CSS framework, and you can customize the look as much as you want.

I was recently looking at the new design of A Small Orange, a hosting company. Would you guess, just looking at it, that it uses Bootstrap?

I didn’t realize at first, until I moused over an image and noticed the popover that appeared. I recognized it as a re-colored Bootstrap feature, and checked the page source to confirm it. Handy, easy to implement, and yet you could even restyle it beyond recognition if you wanted to.

Continue reading →

GluePHP — A Spartan URL Routing Framework

For larger PHP projects, it’s a good idea to use the Model-View-Controller pattern and URL routing to organize things a bit more logically and make the code easier to update in the future. Frameworks like CodeIgniter, Kohana and CakePHP do this, but they can be overkill for some projects.

Enter GluePHP.

GluePHP is a lightweight framework (really, it’s a single class!) that only does one thing: it routes URLs to PHP  classes. It “glues” (the developer’s pun, not mine) everything together by routing URLs like example.org/asdf to your class with the name “asdf.” By implementing GET() and POST() methods, you can fire off other methods and output results.

A simple example, that doesn’t use any of the more advanced features like regular expressions in URLs, would look like this (from the documentation):

require_once('glue.php');

$urls = array(
'/' => 'index'
);

class index {
function GET() {
echo "Hello, World!";
}
}

glue::stick($urls);

I would say it’s worth bookmarking if you do much PHP work. It would be great for throwing together quick websites or tech demos.

CodeIgniter 2.0 Released: No More PHP4 Support!

EllisLab just released version 2.0.0 of the CodeIgniter PHP framework. There are a few interesting new additions, such as a cache driver with APC and memcache support, the option to let controller handle 404 errors, and the deprecation and removal of Scaffolding.

Perhaps the best news is that PHP4 support is being dropped in favor of a minimum version of PHP 5.1. Hopefully this means we will see CodeIgniter move towards a more object-oriented approach, like its spinoff/fork Kohana.

Also, CodeIgniter is being split into two branches: Core and Reactor. Core will be a slowly-updated branch that EllisLab will use for their products (e.g. ExpressionEngine), freeing up the primary community-driven Reactor branch to be more quickly developed.

CodeIgniter 2.0.0 Released [CodeIgniter]

Rolling Your Own PHP Framework

Fuel Your Coding has a three-part series worth checking out. It covers how to build your own lightweight PHP framework for your projects.

There are quite a few php frameworks out there. Some huge, some small; Some useful, some not. I often hear developers, even myself, complain about frameworks in php not having or not doing something the way they/we want it too. So my solution? Roll your own framework! This series of articles is going to give you a brief and quick intro on how to do just that. We are going to cover url routing, basic database connection, basic templating and basic rewrite rules for Apache. What we will not cover is ORM development, advanced routing and installation of LAMP (Linux, Apache, MySQL, PHP). Also error checking will be next to none as this is just an example.

It’s a neat tutorial, and in the end you’ll have something useful: an organized basis for future PHP projects. You have an underlying structure that will help you get into building your next application sooner.

Are Premium WordPress Themes Going Out of Style?

There has been some interesting discussion about WPblogger about premium WordPress themes. The author of the original post says “Premium WordPress Themes are Dead.”

Ben Cook suggests that people aren’t really interested in buying an individual theme so much as a highly configurable theme that acts more like a framework. A foundation that they can build upon, tweaking it to look how they want through a backend menu. Essentially, Thesis.

Sure it’s nice that companies like iThemes keep turning out new themes, but they’re fighting a losing battle.

People don’t want to purchase a different theme for every new site they create or every time they want to redesign their site. We want a framework that allows us to make a vast array of design changes as quickly and easily as possible.

Personally, I don’t believe this to be the case. I’m not really a Thesis fan myself, preferring to build my sites’ themes “the real way.” I think people still want to buy themes for the design, not just for a tweakable platform. That’s not to say people don’t want customization, far from it. WooThemes is a prime example. Their themes are primarily design-oriented, but they have plenty of customization options in the backend, albeit less than Thesis. I believe that the two points will converge in the future, bringing more and more customization options to more design-oriented themes.

Though I wonder if frameworks like Hybrid and Thematic will gain similar customization options to Thesis, bringing about a similar result. With customization options in the core of a theme framework like Thematic, and a large community of child theme makers, you have the convergence point I predict, no?

What Are the Advantages of a PHP Framework?

CodeIgniter. CakePHP. Kohana.

There’s no shortage of PHP frameworks…but why should you use one? What are the major advantages?

  • MVC – The Model-View-Controller architectural pattern helps you tier your code for easier maintenance. By keeping the data-manipulating logic separate from the bits that handle the display, you make it much easier to change either the template or the underlying code without touching the other.
  • Bundled classes – A framework includes classes and helper functions for common tasks, such as database access, pagination, and form handling. Not to mention smaller things, like truncating text to a specific word/character count.
  • Rapid development – Frameworks help you create a small to medium-sized application much quicker than if you wrote everything from scratch. If you’re in a hurry, using a framework will help you finish things before you reach that looming deadline.

If you’re a total DIY type, you don’t even need to rely on a third-party PHP framework. You could assemble on yourself, one that’s more specific to the projects you work on.

Kohana: Cleaner CodeIgniter For PHP 5

KohanaOne of the major criticisms of the CodeIgniter PHP framework is its continued support for PHP 4. The developers of the language announced two years ago that PHP 4 development, security patches included, would cease by the end of 2007. The CodeIgniter project still insists on supporting the outmoded PHP version, because far too many shared hosting providers still haven’t upgraded their machines for fear of breaking peoples’ poorly-coded scripts.

While CodeIgniter’s legacy support doesn’t stop you from using PHP 5-specific features in your applications, it does make things a bit less…elegant. If you’re going to build a sports car, would you put an old, less-efficient engine inside it?

Enter Kohana, “the swift PHP framework.”

Kohana is a fork of CodeIgniter, but entirely rewritten to be strict PHP 5 OOP. There are some different conventions, but overall the frameworks are similar enough that migrating is relatively painless. I’m still reading through the documentation, but it seems like it’s definitely worth looking into. Some of you may prefer CodeIgniter for their larger community, but it you’re a developer who has ever been frustrated by CodeIgniter’s decision, then you definitely want to have a look at Kohana.

The 1Kb CSS Grid

Grid Design is something that’s being talked about a bit lately, and many people are using frameworks like 960gs to help them do it.

A recent guest post over at Usability Post (by Tyler Tate) shows how to create a grid with your own CSS, 1KB of CSS to be precise.

Here is a fresh take on the CSS grid (loosely based on Nathan Smith’s 960 Grid System). Its mission is to be lightweight. And, as I’ll show in part 2, it can be used to streamline page templates for content management. All this in just one measly kilobyte (actually, 662 bytes, but who’s counting).

A few CSS rules and you have your own custom grid framework, which you can easily work the rest of your CSS around.

The 1Kb CSS Grid, Part 1 [Usability Post]

40+ Invaluable PHP Tutorials and Resources

My newest post on Net.Tuts+ was published yesterday: 40+ Invaluable PHP Tutorials and Resources

It is a roundup of articles, tutorials and tools of interest to PHP coders, on topics such as security, OOP, frameworks, and WordPress.

PHP is one of the most popular scripting languages on the internet today, and one of the easiest to get into. Whether you’re a PHP newbie, or an experienced code-slinger, there is always something new to discover. A function you’re unfamiliar with a killer timesaving tool, a technique that you forgot about…

Head over to Net.Tuts+ to read the full article.

CodeIgniter – Open Source PHP Web Application Framework

CodeIgniterCodeIgniter is a PHP framework that incorporates the MVC methodology. It’s fairly lightweight, doesn’t require messing around with the console, and once you get used to it, it might make it easier and faster to code.

CodeIgniter simplifies many tasks, such as database I/O and form handling, it’s modular architecture allowing you to load various libraries when you need them. It uses the Model-View-Controller design pattern, where the “View” files are templates and such, with the Models and Controllers doing the heavy lifting. Overall the framework tries to promote cleaner, more efficient coding.

Some people don’t like frameworks, some people are lost without them. I’m somewhere in between. They can be helpful in some situations, but I tend to be a bit more DIY when it comes to PHP. It’s all a matter of personal preference, and of course choosing the right tool for the job.

If you have a bit of experience with PHP, it may be worth giving CodeIgniter a look.