Absolute Path For Codeigniter

In an earlier post I spoke about a missing helper in Codeigniter.  An absolute path, particularly useful when handling images and files.

I think it is probably better to extend the core helper path.

Create a file applications/helpers/MY_path_helper.php

<?php
/**
 * Absolute Path
 *
 * Returns an absolute path based on your basepath.
 * Segments can be passed via the
 * first parameter either as a string.
 * ie absolute_path('uploads/images/cow/)
 * would
 *
 * @access    public
 * @param    string
 * @return    string
 */
if ( ! function_exists('absolute_path'))
{
    function absolute_path($path = '')
    {
        $abs_path = str_replace('system/',$path, BASEPATH);
        //Add a trailing slash if it doesn't exist.
        $abs_path = preg_replace("#([^/])/*$#", "\\1/", $abs_path);
        return $abs_path;
    }
}

You can now call this function anywhere (provided you have loaded the helper).

print absolute_path();

 

dyn.com is the worst service in the world

I’ve been with them a few years but now they are so interested in the money grab I can’t even find how to update my dns zone.

Kick them into touch – they are useless.

They don’t even have contact form on their website.

I’ll run a quick check to see who you should be using.

In the meantime vote with your feet and tell Dyn.com  to f**k off.

Drupal is dead

So I have finally got rid of Drupal as my choice of CMS and changed to WordPress.  OK I know that I’m still using a default theme but I have never claimed to be a designer.  As a company we still use Drupal for e-commerce sites although that may well change in the near future.  The majority of our commercial sites are built using Codeigniter or raw PHP which is of course my preferred option.

Why have you dropped Drupal you might well ask?

Simply that for all it’s claims it doesn’t cut the mustard. For simple presence type commercial websites (standard 5 page sites) it is too big.  For heavy data processing sites it is over complicated to develop with. A very good case in point is this blog.

In first case we find that it takes too long to get the final few changes done and the average user seems to struggle with the user interface. I’ll expand on this a bit.

WordPress ImageDrupal out of the box is no different to WordPress, Joomla or any other system. To get anywhere near to a WordPress type blogging site you need to add quite a few modules. then comes the dreaded themeing (that’s their spelling by the way) job. This can take so long and normally all the profit out of the job.

I know Drupal has an easy way to easily create new content types but in reality you normal don’t allow the end user access to these functions because its beyond them. The admin panel is a nightmare for non-technical users – which most of our clients are, which is why they asked us to build the site.

Heavy lifting applications are easier to build and debug, tailor, tweak and change when you have built the source code yourself, hence any really serious stuff we use codeigniter. We have tried to use Drupal but you end up building so many modules using what think is an average API that is faster to build from scratch.

Access Control Levels

One of the things missing from codeigniter is access control levels ACL or access control libraries as some might say. Drupal has an excellent ACL out of the box so I decided to make one for regular use on Codeigniter.

Now I want to make sure that this ACL can be used either through roles or individual basis. Groups for me is a collection container of people that are linked together. Individuals still have a role within their group(s) which is why I think it’s important to set access against individual members. However you can still use roles as a way to set individual’s permissions.

Continue reading