summaryrefslogtreecommitdiff
path: root/smartyplugins/block.sortlinks.php
diff options
context:
space:
mode:
authorWill James <will@onnyturf.com>2010-06-13 22:22:32 -0400
committerWill James <will@onnyturf.com>2010-06-13 22:28:13 -0400
commit4dac9171db44be0a1f696a81f167713ad043fb17 (patch)
treef0ded954837de74e1d33475a85c529c55196b9ba /smartyplugins/block.sortlinks.php
parent6749e1edb9ab91649401f69ff71776ae7ee9de02 (diff)
downloadthemes-4dac9171db44be0a1f696a81f167713ad043fb17.tar.gz
themes-4dac9171db44be0a1f696a81f167713ad043fb17.tar.bz2
themes-4dac9171db44be0a1f696a81f167713ad043fb17.zip
move smarty to themes
Diffstat (limited to 'smartyplugins/block.sortlinks.php')
-rw-r--r--smartyplugins/block.sortlinks.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/smartyplugins/block.sortlinks.php b/smartyplugins/block.sortlinks.php
new file mode 100644
index 0000000..7713656
--- /dev/null
+++ b/smartyplugins/block.sortlinks.php
@@ -0,0 +1,37 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Smarty plugin
+ * -------------------------------------------------------------
+ * File: block.sortlinks.php
+ * Type: block
+ * Name: sortlinks
+ * -------------------------------------------------------------
+ */
+function smarty_block_sortlinks($params, $content, &$gBitSmarty)
+{
+if ($content) {
+ $links=spliti("\n",$content);
+ $links2=array();
+ foreach ($links as $value) {
+ $splitted=preg_split("/[<>]/",$value,-1,PREG_SPLIT_NO_EMPTY);
+ $links2[$splitted[2]]=$value;
+ }
+
+ if( isset( $params['order'] ) && $params['order']=='reverse' ) {
+ krsort( $links2 );
+ } else {
+ ksort($links2);
+ }
+
+ foreach($links2 as $value) {
+ echo $value;
+ }
+}
+}
+?>