CodeIgniter based Fuel CMS

I recentley discovered a new CMS called Fuel. It is based on the PHP framework CodeIgniter and I feel it has huge potential.

Below is a post I added to the Fuel forums on why Fuel differs from other CMS systems.

When I start a project I tend to go for WordPress if a need a general blog / CMS and then if the project is a little more bespoke I will go for CodeIgniter.

Sometimes with a WordPress project it will be 90% CMS and 10% something that isn’t included or there are no plugins for. For this I will create my own plugin.

Then there is the other angle where the bespoke project needs some basic content e.g. about page, links etc.

This is where I feel Fuel really shines. Having all the functionality of CI for the more complex pages is extremely useful and the client need never be involved in this pages. Or if they do need to somehow control these ages such as through adding items to a database it is made very simple through the admin modules.

The modules also make it very quick to create the forms for users to enter and edit the data.

As admin said the others have a larger user base, but I feel this is primarily down to the fact they have been around longer. If you look at Fuel in conjunction with CI then there is actually a vast amount of libraries and contributions as well as documentation.

The only slightly negative thing I have felt so far is that the documentation is not as mature as I would hope. Although the speed and helpfulness of the admin in answering questions has meant that in a short space of time I have got really far in my first Fuel based project.

As I become more knowledgable with Fuel I will be looking to add to the documentation myself, which is exactly how all the other open source projects have evolved into the successes that they are.

I’m sure there will still be times where I use WordPress or a straight CI application, or possibly other frameworks, for projects but I already have two projects in mind that will be based in Fuel and I’m sure many more to follow.

The Fuel website, along with the forum and documentation can be found at http://www.getfuelcms.com/

Or you can download Fuel on GitHub https://github.com/daylightstudio/FUEL-CMS

CodeIgniter allow hyphen in url

CodeIgniter

I’ve done some reading about hyphens vs underscores in urls and personally I prefer hyphens. I find it seems to keep the words separate where as a underscores seem to join them together in my eyes.

PHP functions don’t allow hyphens in their name so I have to use underscores.

To solve this in CodeIgniter, so the correct function name is found from the uri segment, only one simple change needs to be made.

In system/libraries/Router.php find line 153 and change this line

$segments = $this->_validate_request($segments);

to

$segments = $this->_validate_request(str_replace(“-“, “_”, $segments));

All we need to do is do a string replacement so hyphens become underscores.

URBANE Project launched

The URBANE project is a study of urban coastal defences. The website provides information about the project and those involved. The partners page has a Google map linked to an unordered list that acts as dual functionality to view more details on the partners.

The overlay effect that I wrote for the partners list is utilised again in the image galleries.

The site is built on HTML5 with some subtle use of CSS3.

Blue Sound launched

The Blue Sound project aims to encourage people in the Plymouth area to use the ‘blue space’ around them.

The website aims to involve local youth groups to participate in work groups with myself and the Blue Sound project officer to enable us to provide the users with a site that they can truly feel is theirs.

The site uses HTML5 and CSS3, including CSS drop shadows, rounded corners and transitions.

Destroying CodeIgniter Sessions when closing the browser

I’m really enjoying using CodeIgniter, it’s an excellent framework and has a side benefit of helping to structure your files neatly.

I’ve been working on my first login form using it, and whilst there are lots of tutorials going through this common process I encountered a “problem” with the CodeIgniter sessions persisting when the user closed their browser.

A bit of searching around and I came up with a few recommendations.

The first is to set the $config[‘sess_expiration’] to 0

This however has the effect of creating a cookie which actually lasts 2 years due to code in the system/libraries/Session.php file

The next was to set the $config[‘sess_expiration’] to -1

This just didn’t work for me full stop. When I logged in it saved the session variable then when I went to the next page it had disappeared.

The solution I have used came from this page.

http://codeigniter.com/forums/viewthread/70036

It’s pretty quick to implement the code and you can have control over the expiration time as well as choosing whether your cookie should be persistent.

And now it’s implemented I intend to copy the Session.php file into every project I create that requires sessions. I can handle having to paste in one line of code to the config file.