yourarthere.net

Version Control with CodeIgniter

Posted in backend, coding, organization by Brittany on April 3, 2010

When it came to redesigning yourarthere.net, we had a problem with the base_url() function regarding assets. Eventually we want to convert the v1 directory redirect to just a root url with the contents of the v2 directory in its place. Long story short, we found Shawn McCool’s lovely article on managing assets with CodeIgniter and followed his tutorial. All you have to do is add his path_helper file, autoload some helpers, and edit the applications/config/config.php file. Instead of using his function as asset_url(), we took it a step further by making it a version_url(). So our config looks like this:

$config[‘base_url’] = “http://yourarthere.net/”;

$config[‘version_path’] = ‘v2/’;

So now, whenever we call version_url(), we generate the base_url with the version_path. Below is an example of how we are linking an asset (replace parenthesis with correct php format):

<script type="text/javascript" src="(?php echo version_url(); ?)assets/js/validation.js">

Advertisements
Tagged with: , ,

Comments Off on Version Control with CodeIgniter

%d bloggers like this: