Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[MOD] Accordion for News
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2.08 Mods Completed

Unknown User
2013-01-07 17:37:57
Hi so i post here my first mod  :ph34r:

Info : This mod allows you to have an accordion-like news reader (pictures are down)

Disclaimer : - I don't did the accordion by myself i used one provided by Switchroyale and integrated it.

- Tested it on v2.08 -> fully compatable

- There is some text in french inside it, (think there is a "le" & a "à", on same line as comments) ; change "le" to "the" and "à" to "at"

Edit :  [url="https://www.torrenttrader.org/index.php?/topic/17646-mod-better-jquery-news-accordion/"]https://www.torrenttrader.org/index.php?/topic/17646-mod-better-jquery-news-accordion/[/url]

Installation :

Go to index.php find :



if ($site_config['NEWSON'] && $CURUSER['view_news'] == "yes"){

Under






if (mysql_num_rows($res) > 0){






Replace this line :







print("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td>n<ul>");






with this one :







print("<div id="accordion-container">");






Remove this while loop and the print after his end " } " :







while($array = mysql_fetch_assoc($res)){

if (!$array["username"])

$array["username"] = T_('UNKNOWN_USER');

$numcomm = get_row_count("comments", "WHERE news='".$array['id']."'");

// Show first 2 items expanded

if ($news_flag < 1) {

$disp = "block";

$pic = "minus";

} else {

$disp = "none";

$pic = "plus";

}

print("<br /><a href="javascript: klappe_news('a".$array['id']."')"><img border="0" src="".$site_config["SITEURL"]."/images/$pic.gif" id="pica".$array['id']."" alt="Show/Hide" />");

print("&nbsp;<b>". $array['title'] . "</b></a> - <b>".T_("POSTED").":</b> " . date("d-M-y", utc_to_tz_time($array['added'])) . " <b>".T_("BY").":</b> $array[username]");

print("<div id="ka".$array['id']."" style="display: $disp;"> ".format_comment($array["body"])." <br /><br />".T_("COMMENTS")." (<a href='comments.php?type=news&amp;id=".$array['id']."'>".number_format($numcomm).")</a></div><br /> ");

$news_flag++;

}

print("</ul></td></tr></table>n");








Now paste this loop instead :









while($array = mysql_fetch_assoc($res)){

if (!$array["username"])

$array["username"] = T_('UNKNOWN_USER');

$numcomm = get_row_count("comments", "WHERE news='".$array['id']."'");

print("<h2 class="accordion-header"><span>".$array['title']."</span></h2>");

print("<div class="accordion-content"><br />&nbsp;".format_comment($array["body"])."<br /><br /><hr class="accordion-hr"/><p class="accordion-left">".T_("POSTED")." ".T_("BY")." ".$array[username]." à ". date("H:i", utc_to_tz_time($array['added'])) . " le ".date("d-M-y", utc_to_tz_time($array['added']))."</p><p class="accordion-right"><a href='comments.php?type=news&amp;id=".$array['id']."'>".T_("COMMENTS")." (".number_format($numcomm)."</a>)</p><br /></div>");

$news_flag++;

}

print("</div>");






In your themes/NB-TT-3c upload the attached file vallenato (i edited the css to fit with the design, the NB-TT theme, which is in my point of vue very nice) :



Now in the header.php  paste those line inside the <head> tag :







<script src="<?php echo $site_config["SITEURL"]; ?>/themes/NB-TT-3c/vallenato/jquery-latest.js" type="text/javascript"></script>

<script src="<?php echo $site_config["SITEURL"]; ?>/themes/NB-TT-3c/vallenato/vallenato.js" type="text/javascript"></script>

<link rel="stylesheet" href="<?php echo $site_config["SITEURL"]; ?>/themes/NB-TT-3c/vallenato/vallenato.css" type="text/css" media="screen">




if you use another theme, folder, aso.. think about renaming the path.





N.B. To download the original &/or see it in action :  [url="http://www.switchroyale.com/vallenato/"]http://www.switchroyale.com/vallenato/[/url]

[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6457"]vallenato.rar[/url]
vallenato.rar
Download
Unknown User
2013-01-07 20:25:54
Thank you.
Unknown User
2013-01-07 21:12:06
installed, thanks.^^
Unknown User
2013-01-07 22:09:12
Something is wrong:

Parse error: syntax error, unexpected $end in /webroot/b/t/...../...../www/index.php on line 106

it is the end of the file: ?>
Unknown User
2013-01-07 22:16:47
I think the problem is this line:



if (mysql_num_rows($res) > 0) {



if i remove " {  " it the shows the page but with an error:

Warning: mysql_num_rows() expects parameter 1 to be resource, null given in /webroot/b/t/...../.......com/www/index.php on line 29



Help please.
Unknown User
2013-01-07 22:18:23
May you post your code please. So i can look at it.
Unknown User
2013-01-07 22:21:06
yea you are wrong there, that way it should work :



//Site News

if ($site_config['NEWSON'] && $CURUSER['view_news'] == "yes"){

begin_frame(T_("NEWS"));

$res = SQL_Query_exec("SELECT news.id, news.title, news.added, news.body, users.username FROM news LEFT JOIN users ON news.userid = users.id ORDER BY added DESC LIMIT 10");

if (mysql_num_rows($res) > 0){

 print("<div id="accordion-container">");

 $news_flag = 0;

Unknown User
2013-01-07 22:44:40
Ha sweeet your first statement wasn't clear to me but now i understand. Thank you, great add on.
Unknown User
2013-01-07 23:01:38
and this?

edit:never mind, i just change it, thank you again.
Unknown User
2013-01-07 23:07:00
yea i edited above its the

à
tag that means à -> change that tag with "at" and the "le" as "the"

(haven't read your edit)
Unknown User
2013-01-08 00:18:19
Haven't tested but looks nice, good work!
Unknown User
2013-01-08 00:39:32
Mine here, works great.



// news

if ($site_config['NEWSON'] && $CURUSER['view_news'] == "yes"){

begin_frame(T_("NEWS"));

$res = SQL_Query_exec("SELECT news.id, news.title, news.added, news.body, users.username, news.userid FROM news LEFT JOIN users ON news.userid = users.id ORDER BY added DESC LIMIT 10");

if (mysql_num_rows($res) > 0){

print("<div id="accordion-container"><table width='100%' border='0' cellspacing='0' cellpadding='0'>");

$news_flag = 0;



while($array = mysql_fetch_assoc($res)){

                if (!$array["username"])

                                $array["username"] = T_('UNKNOWN_USER');

$numcomm = get_row_count("comments", "WHERE news='".$array['id']."'");

print("<h3 class="accordion-header"><span>".$array['title']."</span></h3>");

print("<div class="accordion-content"><br />&nbsp;".format_comment($array["body"])."<br /><br /><hr class="accordion-hr"/><p class="accordion-left">".T_("BY")." <a href=account-details.php?id=". $array[userid]."><strong>".$array[username]."</strong></a>, ".T_("POSTED")." ". date("H:i", utc_to_tz_time($array['added'])) . " - ".date("d-M-y", utc_to_tz_time($array['added']))."</p><p class="accordion-right"><a href='comments.php?type=news&amp;id=".$array['id']."'>".T_("COMMENTS")." (".number_format($numcomm)."</a>)</p><br /></div>");

$news_flag++;

}

print("</table></div>");

}else{

echo "<br /><b>".T_("NO_NEWS")."</b>";

}

end_frame();

}



// news
Unknown User
2013-01-08 16:21:42
How to make the new or closed loading index

Thank you
Unknown User
2013-01-10 14:31:34
don't understand what you mean
Unknown User
2013-01-17 02:51:01
Goood work like a charm and beautiful :D
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 3
  • Members: 0
  • Guests online: 3
  • Comments: 3
  • Messages: 1,728