Everything is working well and you can add news by inserting rows to db
requirements: version of in-orbit
SQL
Code:
CREATE TABLE IF NOT EXISTS `news` ( `nID` int(11) NOT NULL AUTO_INCREMENT, `newsID` varchar(50) NOT NULL DEFAULT 'default', `image` varchar(50) NOT NULL DEFAULT 'default.gif', `icon` varchar(50) NOT NULL DEFAULT 'default.gif', `headline` varchar(100) NOT NULL DEFAULT 'Default Headline', `text` text NOT NULL, PRIMARY KEY (`newsID`), UNIQUE KEY `nID` (`nID`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; INSERT INTO `news` (`nID`, `newsID`, `image`, `icon`, `headline`, `text`) VALUES (7, 'firstnews', 'default.gif', 'default.gif', 'News!', 'Not working/bugged: (~progress)<br><br>\n <ul>\n <li><b class="breakingNewsHighlightBlue">-> GalaxyGateGenerator (40%)</b></li>\n <li><b class="breakingNewsHighlightBlue">-> Skylab (40%)</b></li>\n <li><b class="breakingNewsHighlightBlue">-> Equipment (95%)</b></li>\n <li><b class="breakingNewsHighlightBlue">-> Pilotbio (2%)</b></li>\n <li><b class="breakingNewsHighlightBlue">-> more minor things..</b></li>\n <li><b class="breakingNewsHighlightBlue">alot more..</b></li>\n </ul>\n <br><br> Do not try to use this features. You will NOT get refunded.\n \n <br><br>\n <br><br>\n Your DarkPlanets team'), (6, 'premium', 'benefitPremium.gif', 'benefitPremium.gif', 'Premium!', 'Get premium today and help<br>this server to grow!<br><br><br><br>Your DarkPlanets-Team'), (8, 'serverstatus', 'default.gif', 'default.gif', 'Serverstatus!', '<b class="breakingNewsHighlightBlue">As you might already saw, is the spacemap offline. We do some bugfixing and updates to get rid of some annoying bugs e.g. losing ammo, missing drones and others. Maybe we finish that until monday, maybe earlier, or maybe not. We do our best to keep this downtime as short as possible.</b><br><br>\n\n \n <br><br>\n <br><br>\n ~Underworld');
add this to init.php (\KERNEL-DOCMS\)
PHP Code:
require_once 'Class.news.php';
PHP Code:
<?php
class news
{
/**
* /do_img/global/events/
* /do_img/global/events/icons/
*/
private $con;
private $data;
private $cnt;
public function __construct() {
$this->con = $GLOBALS['DB'];
}
public function init(){
$qry = $this->con->prepare("SELECT * FROM news ORDER BY nID DESC LIMIT 7");
if ($qry->execute()){
if ($qry->rowCount() != 0){
$this->cnt = $qry->rowCount();
$arr = $qry->fetchAll(PDO::FETCH_ASSOC);
$this->data = array_combine(range(1, count($arr)), array_values($arr));
return TRUE;
}else
return FALSE;
}else
return FALSE;
}
public function get($type){
$ret = "";
for($i=1;$i<=$this->cnt;$i++){
if($type == "icons"){
$spc = ($i != 1) ? "style=\"margin-left: 6px;\"" : "";
$ret .= "<img id=\"newsIcon_" . $this->data[$i]['newsID'] . "\" class=\"breakingNewsIcon\" src=\"./do_img/global/events/icons/" . $this->data[$i]['icon'] . "\" width=\"21\" height=\"21\" " . $spc . ">";
}elseif($type == "news"){
$spc = ($i != 1) ? "style=\"display: none;\"" : "";
$ret .= "<div id=\"newsText_" . $this->data[$i]['newsID'] . "\" class=\"newsTextContainer\" " . $spc . "><h3>" . $this->data[$i]['headline'] . "</h3>" . $this->data[$i]['text'] . "</div>";
}elseif($type == "images"){
$spc = ($i != 1) ? "style=\"display: none;\"" : "style=\"display: block;\"";
$ret .= "<img id=\"newsImage_" . $this->data[$i]['newsID'] . "\" src=\"./do_img/global/events/" . $this->data[$i]['image'] . "\" class=\"newsImage oldNews\" " . $spc . ">";
}elseif($type == "jsarray"){
$ret .= "newsItemIds.push('" . $this->data[$i]['newsID'] . "');";
}elseif($type == "jsarray2"){
$ret .= "uploadedNewsIds.push('" . $this->data[1]['newsID'] . "');";
break;
}
}
return $ret;
}
}
?>
go to \KERNEL-DOCMS\Files\en_US\INDEXINTERNAL\internalStart_Body .php
and find
Code:
<div id="homeNewsContent">
Code:
<div id="homeNewsContent">
<?php
// news
$newsC = new news();
$newsC->init(); ?>
<script type="text/javascript" language="javascript">
var newsItemIds = new Array();
<?php echo $newsC->get("jsarray"); ?>
var uploadedNewsIds = new Array();
<?php echo $newsC->get("jsarray2"); ?>
</script>
<div id="breakingNewsHeadline">
<span class="bnHead_<?php echo ($Users->DataRow['factionId'] === '1') ? 'mmo' : (($Users->DataRow['factionId'] === '2') ? 'eic' : 'vru'); ?>"><?php echo ($Users->DataRow['factionId'] === '1') ? 'MMO' : (($Users->DataRow['factionId'] === '2') ? 'EIC' : 'VRU'); ?></span> NEWSLETTER
</div>
<div id="breakingNewsTop">
<div class="empty"></div>
<div id="newsImageOverlay" style="display: block;"></div>
<?php echo $newsC->get("images"); ?>
</div>
<div id="breakingNewsLeftArrow" class="breakingNewsArrow"></div>
<div id="breakingNewsRightArrow" class="breakingNewsArrow"></div>
<div id="breakingNewsIconWrapper">
<?php echo $newsC->get("icons"); ?>
<div id="newsIconHighlight" style="left: 54px;"></div>
</div>
<div id="breakingNewsTopGradiant"></div>
<div id="breakingNewsBottomGradiant"></div>
<div id="breakingNewsText" class="js-scroll-pane" tabindex="0" style="overflow: auto; padding: 0px; width: 320px; height: 229px;">
<?php echo $newsC->get("news"); ?>
</div>
</div>
that's it






