Wednesday, September 30, 2009

jct - most commented today filter!!!

OMG!!!!!!!!!!!!!!!!!!!!!!

I'm so excited! I just wrote code across three different files without any help from the forum and it works!

So, to create the most commented today filter for the news,
1) in libs/search.php
Added a info for a search function


}elseif ($setmek =='commented'){
$this->filterToTimeFrame = "today";
$this->orderBy = "link_comments DESC";

so now a search that looks for commented will filter the results to today only
and order it by number of comments descending

2) in sidebar2.tpl
Added in a radio button in the sort news column

{if $setmeka eq "commented"} ....

check the file for the rest of the code - I can't get blogger to keep it as a blcokquote and not turn it into links. v annoying.

3) in libs/smartyvariables.php
Needed to assign instructions re what to do with $index_url_commented (part of step 2 code)
in the commented section //set up the sorting links on the index page in smarty. This will tell it how to write the URL for that page
$main_smarty->assign('index_url_commented', getmyurl('index_sort', 'commented', $pligg_category));
So now, there's a radio button that sorts todays news by most commented!


No comments:

Post a Comment