[pLog-svn] r2446 - plog/branches/plog-1.0.2/class/template/smarty/plugins

jondaley at devel.plogworld.net jondaley at devel.plogworld.net
Sat Sep 3 21:27:38 GMT 2005


Author: jondaley
Date: 2005-09-03 21:27:38 +0000 (Sat, 03 Sep 2005)
New Revision: 2446

Added:
   plog/branches/plog-1.0.2/class/template/smarty/plugins/modifier.substr.php
Log:
I don't know if anyone else would find this useful, but I think it would be nice

Added: plog/branches/plog-1.0.2/class/template/smarty/plugins/modifier.substr.php
===================================================================
--- plog/branches/plog-1.0.2/class/template/smarty/plugins/modifier.substr.php	2005-09-03 15:56:04 UTC (rev 2445)
+++ plog/branches/plog-1.0.2/class/template/smarty/plugins/modifier.substr.php	2005-09-03 21:27:38 UTC (rev 2446)
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Smarty substr modifier plugin
+ *
+ * Type:     modifier<br>
+ * Name:     smarty<br>
+ * Purpose:  make php's substr available to templates.
+ */
+function smarty_modifier_substr($string, $start = -1, $length = -1){
+   if($start == -1 && $length == -1)
+     return substr($string);
+   else if($length == -1)
+     return substr($string, $start);
+   else
+     return substr($string, $start, $length);
+}
+
+?>




More information about the pLog-svn mailing list