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] Better Jquery News Accordion
Controls ·  Search New posts · Mark unread

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

Unknown User
2013-03-06 16:49:18
Ok so i have recently posted the integration of vallenato accordion but he sounds to buggy (try resize page and you'll see).

This one is based on the original from jQuery accordion and fix some bugs.

Find in index.php :

[url="http://jqueryui.com/themeroller/"]http://jqueryui.com/themeroller/[/url]. See end of css attachment.



//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("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td>n<ul>");

$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']."'");

// Show first 2 items expanded

if ($news_flag < 2) {

$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");

}else{

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

}

end_frame();

}

Replace with :






/**********************************************************************************************/

/* JQUERY ACCORDEON MOD */

/**********************************************************************************************/

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">');

$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><a href="#">".$array['title']."</a></h3>");

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

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



end_frame();

}

?>

<script>

$( "#accordion" ).accordion({

active: false, collapsible: true, heightStyle: "content", alwaysOpen: false

});

</script>

<?php








In your theme header.php, place this :







<link rel="stylesheet" href="<?php echo $site_config["SITEURL"]; ?>/themes/YOURTHMEGOESHERE/accordion/jquery-ui-1.10.1.custom.css">

<script src="<?php echo $site_config["SITEURL"]; ?>/themes/YOURTHMEGOESHERE/accordion/jquery-1.9.1.js"></script>

<script src="<?php echo $site_config["SITEURL"]; ?>/themes/YOURTHMEGOESHERE/accordion/jquery-ui-1.10.1.custom.js"></script>






Extract the attached file to the root of your current theme.



Done



N.B. :



A) Try formatting that line with your taste. The class="accordion-content" , class="accordion-hr" , class="accordion-left", lass="accordion-right" where added after so if you want to dl another theme but keep the formatting add those classes under your downloaded css



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]." at ". date("H:i", utc_to_tz_time($array['added'])) . " the ".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>");




The "à" and "le" are already changed inside the code up. If you speak another language change them.



[url="http://devscorner.xyz/applications/core/interface/file/attachment.php?id=6629"]accordion.rar[/url]
accordion.rar
Download
2013-03-09 14:20:46
Big thanks you! #1  :)


2013-03-19 03:38:55
works pretty good. I wonder what we can do to highlight URL links. I have a few local URL links in my news area, but the text is just white like the rest of the news text.

And how do you make the newest news item to start open. Mine are all collapsed
TTv3 Micro Edition
Ubuntu 20.04.6 LTS Server
Mysql Version: 10.3.39-MariaDB-0ubuntu0.20.04.2
PHP Version: 7.4.3-4ubuntu2.20
Apache Version: Apache/2.4.59 (Ubuntu)
Unknown User
2013-03-19 17:35:29
And how do you make the newest news item to start open. Mine are all collapsed  :

$( "#accordion" ).accordion({

collapsible: true, heightStyle: "content"

});

I have a few local URL links in my news area, but the text is just white like the rest of the news text.

http://stackoverflow.com/questions/332384/jquery-accordion-links-dont-work (Problem solved)

Thanks for feedback  :) ,

It's a fast answer, i'll look later at it when i have more time. Btw don't hesitate to visit jquery api for more details on what you can do with it.
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: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728