I would like to add a feature articles section to my php nuke site version 7.4 such as the one that MET Open has created for their modified news module.
I would like to add it to my news module so that it appears at the top.
Here is the coding of the MET Open modified news
ANy help would be appreciated.
Regards,
Micah
__________________________
<?php
/************************************************************************/
/* MetOpen Home Page */
/* (C) Heshy Shayovitz for support http://www.metopen.com */
/* */
/* */
/* PHPNUKE Copyright (c) 2005 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}
global $module_name;
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$index = 1;
global $prefix, $currentlang, $sitename, $user, $db;
global $bgcolor, $bgcolor1, $bgcolor2,$bgcolor4;
/************************************************************/
/* Preferences */
$bgcolor=_BGCOLOR;
if ($bgcolor == "") $bgcolor=$bgcolor2;// "#ecf0f6";//"azure";//
//FEATURES
$catidfeature=_CATIDFEATURE; //category id for features
$numfeatures=_NUMFEATURES; //number of stories in the features section
//ARTICLES
$catidarticle=_CATIDARTICLE;
$numdaysrecent=_NUMDAYSRECENT; //how recent in days should stories be shown. the number can increase if minnumart is greater (then it will show older articles)
$minnumart=_MINNUMART; //number of stories in the articles section. Enter 0 for none.
$numfullart=_NUMFULLART; //number of stories in the articles section with the first paragraph
$numarticleimages=_NUMARTICLEIMAGES; //number of "full" articles that get topic images
//TIPS
$catidtip=_CATIDTIP;
$numtips=_NUMTIPS; //number of stories in the tips section. Enter 0 for none.
Function DisplayFeature($sid, $title, $hometext, $ratings, $score, $topictext,$topicid, $image=""){
global $admin;
echo '<div class="feature" >';
echo "<span class=\"storytitle\">";
if(stristr( $hometext,"<img ") === FALSE and $image > "") echo "<a title=\""._BREAD.' '._TOPIC."\" href=\"article-topic-.html$topicid\" ><img alt=\"$topictext\" border=\"0\" src=\"images/topics/".$image."\" align=\"right\"></a>"; //if there is an image in the article dont display the topic image
echo "<center><a class=\"featuretitle\" href=\"article.html".$sid."\" >$title</a></center></span>";
displaystars($ratings,$score);
//echo "<br>";
echo "<span class=\"featuretext\" >$hometext</span>";
echo '</div><div class="articlefuncs" >';
DisplayButtons($sid,$title);
echo "<br>
</div>";
}
function HotSpot($hotspottxt,$hotspotblock){
if($hotspottxt > ""){
echo '<div class="hotspot">'.$hotspottxt;
if (substr($hotspotblock,0,6) == "block-"){
$file = @file("blocks/".$hotspotblock."");
if (!$file) {
$content = _BLOCKPROBLEM;
} else {
@include("blocks/".$hotspotblock."");
}
echo $content;
}
echo '</div>';
}
}
function DisplayButtons($sid,$title){
global $module_name,$nukeurl,$admin;
if (is_admin($admin)) {
echo "[<a href=\"admin.php?op=EditStory&sid=".$sid."\">"._EDIT."</a>] ";
}
//Section2 Create section to hold both Tips and Articles
echo "<div>";
//display tips first so it can go to the right
if ($numtips > 0){// should we display the tips section
echo '<span class="tips">';
HotSpot(_HOTSPOT5,_HOTSPOTBLOCK5);
//OPEN COLUMN 2
echo "<span class=\"title\">"._TIPSMOSTRECENT."</span> ";
$result = $db->sql_query("select s.sid, s.title, s.hometext, s.ratings, s.score, t.topictext, t.topicid from ".$prefix."_stories s, ".$prefix."_topics t where catid='$catidtip' and t.topicid = s.topic order by time DESC limit 0,$numtips");
list($sid, $title, $hometext, $ratings, $score, $topictext, $topicid) = $db->sql_fetchrow($result);
echo DisplayArticle($sid, $title, $hometext, $ratings, $score,"colspan=\"2\"", $topictext, $topicid, "");//no image for tips
HotSpot(_HOTSPOT6,_HOTSPOTBLOCK6);
//Display other recent tips
echo "<span class=\"title\">"._TIPSMORE."</span>";
while(list($sid, $title, $hometext, $ratings, $score) = $db->sql_fetchrow($result)) {
$i=$i+1;
echo DisplayArticleLine($sid, $title, $hometext, $ratings, $score, $i);
}
echo '<div style="text-align:center" class=\"tiny\"><a href="topics.html">'._TIPSREADMORE.'</a> | <a href="submit.html">'._TIPSSUBMIT.'</a></div>';
HotSpot(_HOTSPOT7,_HOTSPOTBLOCK7);
echo "</span>";//close tips
}
HotSpot(_HOTSPOT3,_HOTSPOTBLOCK3);
//ARTICLES
//count articles this month
$sql = "SELECT count(sid), sum( counter ) "
."FROM `".$prefix."_stories` where (TO_DAYS(NOW()) - TO_DAYS(time) <= ".$numdaysrecent.") ";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$countrecent =$row[0];
if ($countrecent < $minnumart) $countrecent = $minnumart;
$sql= "SELECT s.sid, s.title, s.hometext, s.ratings, s.score, t.topictext, t.topicid, t.topicimage, s.catid "
."FROM ".$prefix."_stories s, ".$prefix."_topics t "
."WHERE s.catid in ('$catidarticle','$catidfeature') and t.topicid = s.topic ORDER BY s.sid DESC LIMIT 0 , ".($countrecent+$numfeatures);
//if(is_admin($admin)) echo "AA ".$sql."</br />";
$result = $db->sql_query($sql);
$featuresshown=0;
while(list($sid, $title, $hometext, $ratings, $score, $topictext, $topicid, $topicimage, $catid) = $db->sql_fetchrow($result)) {
//echo "$numfeatures > $featuresshown and $catid == $featureid yy $actuallyshown+ $featuresshown < $countrecent zz<br />";
if ($numfeatures > 0 and $numfeatures > $featuresshown and $catid == $catidfeature){//if this was a feature shown in the features section then skip it
$featuresshown++;
} elseif (($actuallyshown + $featuresshown) < $countrecent or $actuallyshown < $minnumart) {
if ($actuallyshown==0){ echo '<br /><div class="title">'._ARTICLESRECENT.'</div> <hr class="article">';}
$actuallyshown++;
if ($actuallyshown <= $numfullart){//should this be a full article
if ($actuallyshown <=$numarticleimages) $displaytopicimage = $topicimage; else $displaytopicimage = "";
DisplayArticle($sid, $title, $hometext, $ratings, $score,"", $topictext, $topicid, $displaytopicimage);
} else { //just display line
if ($actuallyshown == $numfullart+1) HotSpot(_HOTSPOT4,_HOTSPOTBLOCK4);
echo DisplayArticleLine($sid, $title, $hometext, $ratings, $score, $actuallyshown);
}
}//dont show more articles than we should- including features already shown
}
if ($actuallyshown > 0)
echo '<div class=\"tiny\" style="text-align: center;"><a href="topics.html">'._ARTICLESREADMORE.'</a> | <a href="submit.html">'._ARTICLESSUBMIT.'</a></div>';
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum