From 55e1174884542e7b0f8b9a0605f4dd84927a3468 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Tue, 22 Apr 2008 01:20:59 +0000 Subject: [PATCH] fixed the show by tag --- code/BlogHolder.php | 11 ++++++++++- code/TagCloudWidget.php | 19 ++++++++----------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/code/BlogHolder.php b/code/BlogHolder.php index e93a79a..d9e484b 100644 --- a/code/BlogHolder.php +++ b/code/BlogHolder.php @@ -109,7 +109,7 @@ class BlogHolder extends Page { /** * Only display the blog entries that have the specified tag */ - function Tag() { + function ShowTag() { if(Director::urlParam('Action') == 'tag') { return Director::urlParam('ID'); } @@ -269,6 +269,15 @@ class BlogHolder_Controller extends Page_Controller { return $output; } + function tag() { + if($this->ShowTag()) { + return array( + 'Tag' => $this->ShowTag() + ); + } else { + return array(); + } + } /** * Get the rss feed for this blog holder's entries diff --git a/code/TagCloudWidget.php b/code/TagCloudWidget.php index c5b945a..36beea9 100644 --- a/code/TagCloudWidget.php +++ b/code/TagCloudWidget.php @@ -2,10 +2,10 @@ class TagCloudWidget extends Widget { static $db = array( - "Title" => "Varchar", - "Limit" => "Int", - "Sortby" => "Varchar" - ); + "Title" => "Varchar", + "Limit" => "Int", + "Sortby" => "Varchar" + ); static $defaults = array( "Title" => "Tag Cloud", @@ -111,7 +111,6 @@ class TagCloudWidget extends Widget { "Class" => $class, "Link" => $blogHolder->Link() . 'tag/' . urlencode($tag) ); - Debug::show($allTags[$tag]); } } @@ -139,18 +138,16 @@ function column_sort_by_popularity($a, $b){ return $result; } -function natksort(&$aToBeSorted) - { +function natksort(&$aToBeSorted) { $aResult = array(); $aKeys = array_keys($aToBeSorted); natcasesort($aKeys); - foreach ($aKeys as $sKey) - { + foreach ($aKeys as $sKey) { $aResult[$sKey] = $aToBeSorted[$sKey]; - } + } $aToBeSorted = $aResult; return true; - } +} ?>