Subscribe to RSS Subscribe to Comments

Alan Blaine Whitney

How to add subversion revision into cake template

This post is a quick explaination on how to add a subversion revision number into a cakephp template.  First off you need to tell subversion to place the version into the file.

svn propset svn:keywords “Revision” app/views/layouts/admin.ctp

In this case I am going to add to my admin layout. Now to edit the admin layout.  I am going to add the following line text.

$Revision: $

This will get replaced at every commit/update with

$Revision: 357 $

with the current revision number.

To pull it all together to show the version number. Here is piece of admin.ctp

<?php
$svn = ‘$Revision: $’;
$revision = substr($svn, 11);
$version = intval(substr($revision, 0, strlen($revision) – 2))
?>
(Revision <?=$version?>)

Which will display the current version number.

Cake 1.2RC2 to 1.2RC3

I recently updated a web app from RC2 to RC3.  I replaced the cake dir and replace app/webroot/index.php and app/webroot/test.php.  Deleted my cache files.  Everything went super.  Not one hitch.

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers