First, edit libs/sidebarstories.php. We need to add a category variable to the SidebarStories class. First add a variable as follows in the variable declarations:
Code:
var $category = "";
Code:
$search->category = $this->category;
Code:
class SidebarStories {
var $pagesize = 5; // The number of items to show
var $orderBy = ""; // The sorting order
var $filterToStatus = "all"; // Filter to "all" or just "published" or "queued"
var $category = "";
var $filterToTimeFrame = ""; // Filter to "all" or just "published" or "queued"
var $header = ""; // The text to show at the top
var $template = ""; // The template to use, including folder
function show() {
global $main_smarty, $db;
include_once(mnminclude.'search.php');
$search=new Search();
$search->orderBy = $this->orderBy;
$search->pagesize = $this->pagesize;
$search->filterToStatus = $this->filterToStatus;
$search->category = $this->category;
$search->filterToTimeFrame = $this->filterToTimeFrame;
$search->doSearch();
$linksum_sql = $search->sql;
$link = new Link;
$links = $db->get_col($linksum_sql);
if ($links) {
foreach($links as $link_id) {
$link->id=$link_id;
$link->read();
$main_smarty = $link->fill_smarty($main_smarty);
$main_smarty->display($this->template);
}
}
}
}
Code:
<?php
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
// -------------------------------------------------------------------------------------
include_once('Smarty.class.php');
if(!isset($main_smarty)){$main_smarty = new Smarty;}
// If we're calling this page through another page like index.php, $main_smarty will already be set
// If we're calling this page directly, set main_smarty
include_once('config.php');
include_once(mnminclude.'html1.php');
include_once(mnminclude.'link.php');
include_once(mnminclude.'tags.php');
include_once(mnminclude.'search.php');
include_once(mnminclude.'smartyvariables.php');
include_once(mnminclude.'sidebarstories.php');
Global $the_template;
// for filterTo you can use "published", "queued" or "all"
// to change the way the links look, edit /tempates/<your template>/sidebar_stories.tpl
$ss = new SidebarStories();
$ss->orderBy = "link_votes DESC"; // newest on top.
$ss->pagesize = 10; // the number of items to show in the box.
if(pagename == "index"){
$ss->filterToStatus = "published";
}
elseif(pagename == "upcoming"){
$ss->filterToStatus = "queued";
}
else{
$ss->filterToStatus = "published";
}
if(isset($_REQUEST['category'])){
$ss->header = "Top Stories in " . $_REQUEST['category'];
$ss->category = $_REQUEST['category'];
} else {
$ss->header = "Top Stories in All";
}
if($the_template == "mollio-beat" || $the_template == "acttup") {
echo " <h3>".$ss->header."</h3><div id=ss class=switchcontent>";
$ss->template = $the_template . '/sidebar_stories.tpl';
$ss->show();
echo "</div>";
}
elseif ($the_template == "digitalnature") {
echo "<div class=box><h1><span class=expand><a href=javascript:toggle('stories','expstories'); id=expstories class=expand-up></a></span><a href=javascript:toggle('stories','expstories');".$ss->header."</a></h1><div class=box2 id=stories><div class=wrap><div class=content>";
$ss->template = $the_template . '/sidebar_stories.tpl';
$ss->show();
echo "</div></div></div></div>";
}
elseif ($the_template == "yget") {
echo "<div class=tlb><span><a onclick=\"new Effect.toggle('ssstories','blind', {queue: 'end'}); \"> <img src=\"".my_base_url.my_pligg_base."/templates/yget/images/expand.png\" onClick=expandcontent(this,'ssstories') ></a></span><a href=".my_pligg_base."/upcoming.php>".$ss->header."</a></div><div id=ssstories style=padding-bottom:5px>";
$ss->template = $the_template . '/sidebar_stories.tpl';
$ss->show();
echo "</div>";
}
?>
Code:
{$link_shakebox_votes} - <a href="{$story_url}">{$title_short|truncate:35}</a><br>
Lastly, I wanted it to show no matter which page I was on, so I removed the conditional display option from sidebar.tpl. It was this:
Code:
{if $pagename eq "index" || $pagename eq "upcoming"}
{assign var=sidebar_module value="sidebar_stories"}{include file=$the_template_sidebar_modules."/wrapper.tpl"}
{/if}
Code:
{assign var=sidebar_module value="sidebar_stories"}{include file=$the_template_sidebar_modules."/wrapper.tpl"}





Linear Mode




