Go Back   Pligg CMS Forum > Pligg Development > Modification Tutorials

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-12-2008, 02:52 PM
Casual Pligger
 
Join Date: May 2008
Posts: 50
Thanks: 16
Thanked 5 Times in 5 Posts
Top Feature Stories Header

This is a cool mod that will show the top 3 stories on the site on the top of the page, below the header. It will change to show the top 3 stories in the category you are in also. You can see this live at Test site. I assume you have installed the image upload module also.

First copy this -

Code:
<li><div class="story_image_feature">
               {php}
               // START: Image Upload Module
               check_actions('image_upload_preview', $vars);
               // END: Image Upload Module
               {/php}  <a href="{$story_url}">{$title_short}</a></div></li>
And save that as feature_stories.tpl and out into your template dir.


Then copy this-
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 = 3; // the number of items to show in the box.
	$ss->TitleLengthLimit = 35;
	if(pagename == "index"){
		$ss->filterToStatus = "published";
	}
	elseif(pagename == "upcoming"){
		$ss->filterToStatus = "queued";
	}
	else{
		$ss->filterToStatus = "published";
	}

	if(isset($_REQUEST['category'])){
		$ss->header = "Top Articles In " . $_REQUEST['category'];
		$ss->category = $_REQUEST['category'];
	} else {
		$ss->header = "Top Articles";
	}

	
	
	echo "<div><h1><a href=".my_pligg_base."/upcoming.php>".$ss->header."</a></h1></div><div>";
	$ss->template = $the_template . '/feature_stories.tpl';
	$ss->show();
	echo "</div>";
	
	
?>
And save that as feature_stories.php and put into the root dir.


Open up index_center.tpl and add at the top-

Code:
	{if $pagename neq "story"}
<div id="featurecontainer">
<div id="featurestory"><ul>
  {* ----- show the feature ----- *}

    {php}include('feature_stories.php');{/php}

{* ---------------------------------------- *} 


</div></div></ul>{/if}

Now the most difficult will be the styling. Here is the basic CSS. Copy and past into your CSS file. You may have to make changes depending on your sites structure and size.

Code:
#featurecontainer{
width: 100%;
height: 200px;
background-color:#ffffff;
overflow: hidden;
border:1px solid #f2f2f2;
}
#featurestory {
padding-left:20px;
}
#featurestory ul {
list-style-type: none;

}
#featurestory ul li {
display: inline;
float: left;
width:200px;
}
#featurestory ul li a {
padding-left:5px
color: #000000;
font-size: 9px;
font-weight:bold;
}
#featurestory ul li a:hover {
color: #444444;
text-decoration: none;
}

.story_image_feature img{
width:175px;
height:125px;
padding-left:5px;
padding-right:5px;
padding-top:5px;
padding-bottom:5px;
margin-right:0px;
margin-bottom:0px;
border: 1px solid #f2f2f2;

}
With a combination of edits in the feature_story.php and the CSS, you could easily show more/less as wanted. This is based on a modification from HERE
__________________
OSS Supporter.

Last edited by method20; 09-12-2008 at 05:05 PM..
Reply With Quote
The Following User Says Thank You to method20 For This Useful Post:
Reply

Thread Tools
Display Modes
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Similar Threads
Thread Thread Starter Forum Replies Last Post
New Mod -- Display related stories revenazb Modification Tutorials 46 07-07-2007 01:19 AM
Pligg beta 9.5 [updated] kbeeveer46 Current Version 0 04-29-2007 09:58 PM
"Top" in top Stories Sokora General Help 1 01-30-2007 10:30 PM
No pagination for stories in profile kbeeveer46 Bug Report 0 08-07-2006 01:22 AM
Need help on CSS <h1> header </h1> kepin Template Support 5 02-22-2006 02:32 PM


Search Engine Friendly URLs by vBSEO 3.2.0