[TBDEV][08] v1 News Feed
Quote:
The MIT License (MIT)
Copyright © 2015 UniqueScene
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
|
Edit index.php or if you have created your own block for news then edit that.
Here We Go!
Replace:
Code:
print("<h2>");
if ($CURUSER) {
print("<h2><font color=blue> </font>News<font color=blue> </font>");
if (get_user_class() >= UC_ADMINISTRATOR)
print("<font class=small>[<a class=altlink href=news.php>News page</a>]</font>");
print("</h2>\n");
$res = mysql_query("SELECT * FROM news WHERE ADDDATE(added, INTERVAL 45 DAY) > NOW() ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
print("<table width=100% border=1 cellspacing=0 cellpadding=10><tr><td class=text>\n<ul>");
$news_flag = 0;
while($array = mysql_fetch_array($res))
{
$user = mysql_fetch_assoc(mysql_query("SELECT username FROM users WHERE id = $array[userid]")) or sqlerr();
if ($news_flag < 2) {
print("<a href=\"javascript: klappe_news('a".$array['id']."')\"><br><img border=\"0\" src=\"pic/minus.gif\" id=\"pica".$array['id']."\" alt=\"Show/Hide\"> " . " - " . gmdate("M-d-y",strtotime($array['added'])) . " - " ."<b>". $array['title'] . " - " . "</b><font color=#ff0532> ($user[username]) </font></a>");
print("<div id=\"ka".$array['id']."\" style=\"display: block;\"> ".format_comment($array["body"],0)." </div><br> ");
$news_flag = ($news_flag + 1);
}
else {
print("<a href=\"jav script: klappe_news('a".$array['id']."')\"><br><img border=\"0\" src=\"pic/plus.gif\" id=\"pica".$array['id']."\" alt=\"Show/Hide\"> " . gmdate("M-d-y",strtotime($array['added'])) . " - " ."<b>". $array['title'] . "</b> <!--($user[username])--> </a>");
print("<div id=\"ka".$array['id']."\" style=\"display: none;\"> ".format_comment($array["body"],0)." </div><br> ");
}
if (get_user_class() >= UC_ADMINISTRATOR)
{
print(" <font size=\"-2\"> [<a class=altlink href=news.php?action=edit&newsid=" . $array['id'] . "&returnto=" . urlencode($_SERVER['PHP_SELF']) . "><b>E</b></a>]</font>");
print(" <font size=\"-2\">[<a class=altlink href=news.php?action=delete&newsid=" . $array['id'] . "&returnto=" . urlencode($_SERVER['PHP_SELF']) . "><b>D</b></a>]</font>");
}
print("<div id=\"ka".$array['id']."\" style=\"display: none;\"> ".format_comment($array["body"],0)."</div>");
print("</li>");
}
print("</ul></td></tr></table>\n");
}
with:
Code:
$adminbutton = '';
if (get_user_class() >= UC_ADMINISTRATOR)
$adminbutton = " <span style='float:right;'><a href='news.php'>News page</a></span>\n";
echo "<div style='margin-left: -3px;padding: 1em;width: 900px;' class='mCol'>
<div class='myBlock'><div style='margin-top: 5px;box-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);'>
<div class='myBlock-cap'><span style='font-weight:bold;font-size:12pt;'>Recent News</span>{$adminbutton}</div></div>
<div style='padding: 5px;margin-top: -3px;margin-left: 0px;width: 890px;box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);'></div>
<br />";
$res = mysql_query("SELECT * FROM news WHERE ADDDATE(added, INTERVAL 45 DAY) > ".time()." ORDER BY added DESC LIMIT 10") or sqlerr(__FILE__, __LINE__);
if (mysql_num_rows($res) > 0)
{
// require_once "include/bbcode_functions.php";
$button = "";
while($array = mysql_fetch_assoc($res))
{
if (get_user_class() >= UC_ADMINISTRATOR)
{
$button = "<div style='float:right;'><a href='news.php?action=edit&newsid=" . $array['id'] . "&returnto=" . urlencode($_SERVER['PHP_SELF']) . "'><img style='margin-top: 3px;' width='20' height='20' src='http://i.imgbox.com/gWUsBcEZ.png' title='Edit'/></a> <a href='news.php?action=delete&newsid=" . $array['id'] . "&returnto=" . urlencode($_SERVER['PHP_SELF']) . "'><img style='margin-top: -5px;' width='20' height='20' src='http://i.imgbox.com/fe48nYbb.png' title='Delete'/></a></div>";
}
echo "<div style='margin-top: -15px;margin-left: 5px;width: 890px;box-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);'>
<div class='myBlock-cap'><span style='font-size:8pt;color: #FFF;'>Posted ". gmdate("d-M-y",strtotime($array['added'])) . " {$array['title']}</span>{$button}</div></div>
<div style='padding: 5px;margin-top: -3px;margin-left: 5px;width: 880px;box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);'></div>\n";
echo "<div style='margin-top: -15px;margin-left: 5px;width: 890px;box-shadow: 0 3px 10px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2);'>
<div class='myBlock-con'></div>\n";
echo "<div style='margin-top: -8px;border: 1px solid #222;' class='myBlock-con'>".format_comment($array['body'])."</div>
</div>
<div style='padding: 1.8em;'></div><div style='margin-top: -30px;'></div>";
}
}
echo "</div></div></div>\n";
Quote:
You may have to tweak this to suit your site I just got it to work a few minutes ago tbh and if any bugs please do report
|
|