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.

