You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 71 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Featuyre articles [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
HTR
Guest






PostPosted: Fri Jul 29, 2005 8:35 am Reply with quoteBack to top

Hi all,

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.

/*END PREFERENCES
/**********************************************************/



function DisplayCSS(){
global $bgcolor, $bgcolor1,$bgcolor2,$bgcolor3,$bgcolor4,$textcolor1,$textcolor2;
return '<STYLE TYPE="text/css" MEDIA=screen>
<!--
.feature {background-color: '.$bgcolor.'; width:100% align:center; padding: 3px ;}
.featuretitle {FONT-SIZE: 150%;}
.articlefuncs {text-align:right;}
.tips {background-color: '.$bgcolor.'; border-style: groove; padding: 5px; width:40%; float:right; margin: 10px 0px 10px 10px ;}
.odd {background-color:'.$bgcolor1.'; text-color:'.$textcolor1.';}
.oddhover {background-color:'.$bgcolor2.'; text-color:'.'white'.';}
.even { background-color:'.$bgcolor2.';text-color:'.$textcolor2.';}
.evenhover { hover:'.$textcolor2.'; background-color:'.$bgcolor1.';text-color:'.'white'.';}
hr.hrclass { border-top: 1px dashed #000; border-bottom: 1px dashed '.$bgcolor.'; width: 80%; height: 2px; margin: 3px auto 0 0; text-align: left;}
hr.article { align: left; border-top: 1px dashed #000; border-bottom: 1px dashed '.$bgcolor.'; height: 2px; margin: 3px auto 0 0; text-align: left;}
.hotspot {border-style: solid; border-width: 1px; padding: 3px;}

-->
</STYLE>';



}


/*Functions Section */
Function DisplayArticle($sid, $title, $hometext, $ratings, $score, $colspan, $topictext, $topicid, $topicimage ){
global $admin;
echo "<div><span class=\"storytitle\"><a title=\""._BREAD.' '._TOPIC."\" href=\"article-topic-.html$topicid\" >".$topictext.":</a> "
."<a href=\"article.html$sid\" > $title</a>";
displaystars($ratings,$score);
echo "<br /> </span>";
if ($topicimage > "") echo "<a title=\""._BREAD.' '._TOPIC."\" href=\"article-topic-.html$topicid\" ><img alt=\"$topictext\" border=\"0\" src=\"images/topics/".$topicimage."\" align=\"right\"></a>";
echo '<span class="content">'.$hometext.'</span>';
echo '<div class="articlefuncs">';
DisplayButtons($sid,$title);
echo '<br><br>
</div></div>';//close article div and articlefuncs div
};
//_ADDBOOKMARK
function displaystars($ratings,$score){
if ($ratings != 0) {
$rate = substr($score / $ratings, 0, 4);
$r_image = round($rate);
echo '<img src="images/articles/stars-'.$r_image.'.gif" border="0" title="'.$r_image.' '._OUTOF5STAR.' '.$ratings.' '._VOTES.'">';
}

}

Function DisplayArticleLine($sid, $title, $hometext, $ratings, $score, $i){
global $admin;
if ($i & 1)
echo '<div class="odd" onmouseover="this.className=\'oddhover\'" onmouseout="this.className=\'odd\'">';
else
echo '<div class="even" onmouseover="this.className=\'evenhover\'" onmouseout="this.className=\'even\'">';
echo "<img src=\"images/arrow.gif\" border=\"0\" > ";
echo '<span class="title"><a href="article.html'.$sid.'">'.$title.'</a>';
displaystars($ratings,$score);
echo '</span>';

//echo '<a href="article.html'.$sid.'"> <img src="images/green_dot.gif" title="'._HREADMORE.'" border="0"></a>';
if (is_admin($admin)) {
echo " [<a href=\"admin.php?op=EditStory&sid=".$sid."\">"._EDIT."</a>] ";
}
echo "<br>";
echo "</div>";
}


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>] ";
}

echo "<a href=\"article.html".$sid."\">"._HREADMORE."</a>
<a href=\"modules.php?name=News&file=print&sid=$sid\" title=\""._PRINTABLEVERSION."\"><img alt=\""._PRINTABLEVERSION."\" src=\"images/print.gif\" border=\"0\"></a>&nbsp;
<a href=\"modules.php?name=News&file=friend&op=FriendSend&sid=$sid\" title=\""._SENDTOFRIEND."\"><img alt=\""._SENDTOFRIEND."\" src=\"images/friend.gif\" border=\"0\"></a>&nbsp;";
if(_NUKEBOOKMARK > "") echo "<a href=\"modules.php?name=Bookmarks&amp;file=edit_mark&amp;markname=".urlencode($title)."&amp;markurl=".urlencode("/modules.php?name=$module_name&amp;file=article&amp;sid=$sid&amp;mode=&amp;order=0&amp;hold=0")."&amp;popup=0\" title=\""._NUKEBOOKMARK."\">".'<img src="images/star.gif" border="0" alt="'._NUKEBOOKMARK.'" title="'._NUKEBOOKMARK.'"></a>';
if(_BOOKMARK > "") echo '<a href="javascript:window.external.AddFavorite(\''.$nukeurl.urlencode("/modules.php?name=News&file=article&sid=$sid").'\',\''.$title.'\')"><img src="images/star.gif" border="0" alt="'._BOOKMARK.'" title="'._BOOKMARK.'"></a>&nbsp;';
if(_PDF > "") echo '<a href="modules.php?name='.$module_name.'&amp;file=printpdf&amp;sid='.$sid.'"><img src="images/pdf.gif" border="0" alt="'._PDF.'" title="'._PDF.'"></a>';

}


include("header.php");
echo DisplayCSS();
/* top section for feature */


//opentable();

echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"$bgcolor2\"><tr><td>\n";
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"8\" bgcolor=\"white\"><tr><td>\n";

/*
echo"<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"
. " <tr>"
. " <td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"1\">"
. " <tr>"
. " <td bgcolor=\"#ACB5C3\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
. " <tr>"
. " <td bgcolor=\"#FFFFFF\"><table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">"
. " <tr> "
. " <td bgcolor=\"#DEE0E2\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\">"
. " <tr> "
. " <td>";
*/
HotSpot(_HOTSPOT1,_HOTSPOTBLOCK1);
//FEATURES
if ($numfeatures > 0){ //display the features
echo '<div class="feature">';
echo '<div class="title">'._FEATURE.' </div><hr class="hrclass">';
$sql="select s.sid, s.title, s.hometext, s.ratings, s.score, t.topictext, t.topicid, t.topicimage from ".$prefix."_stories s, ".$prefix."_topics t "
." where t.topicid = s.topic and s.catid='$catidfeature' order by s.time DESC limit 0,$numfeatures";
//if(is_admin($admin)) echo "FF ".$sql."</br />";
$result = $db->sql_query($sql, $db);
while(list($sid, $title, $hometext, $ratings, $score, $topictext, $topicid, $topicimage)= $db->sql_fetchrow($result)) {
DisplayFeature($sid, $title, $hometext, $ratings, $score, $topictext ,$topicid,$topicimage);
}
echo "</div>";//feature
} //only if $numfeatures > 0
HotSpot(_HOTSPOT2,_HOTSPOTBLOCK2);

//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>';

echo "</div>";//close section2

HotSpot(_HOTSPOT8,_HOTSPOTBLOCK8);
//closetable();
echo "</td></tr></table></td></tr></table>\n";
HotSpot(_HOTSPOT9,_HOTSPOTBLOCK9);

include("footer.php");

?>

______________________
Find all posts by Anonymous
Display posts from previous:      
This forum is locked: you cannot post, reply to, or edit topics.  This topic is locked: you cannot edit posts or make replies.printer-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.196 Seconds - 269 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::