View Single Post
  #1  
Old 15th September 2011, 20:36
payaa payaa is offline
Member
 
Join Date: Nov 2009
Hungary
Posts: 4
Default [TBDEV]Expanding news with jquery.cookie
Hi all!

I make my news section with java_klappe. Its slide down and up it's okay, but I see a jquery.cookie javascript that I think we can use that if someone close up the news then this news stay closed up while he/she not open down :)

And stay closed up or open down too when refreshing the page.

There is a demo with jquery.cookie collapse:
http://www.shopdev.c...okies-demo.html

So if someone good in jquery than please help me to make this mod with jquery.cookie.

How looks now the news:
PHP Code:
print("<br><table class=index width=870 class=main border=0 cellspacing=0 cellpadding=3><tr><td>");
print(
"&nbsp;Aktuális hírek");
if (
get_user_class() >= UC_ADMINISTRATOR)
        print(
" - <font class=small>[<a href=news.php><b>Új Hír</b></a>]</font>");
print(
"</table>\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=870 border=0 cellspacing=0 cellpadding=10><tr><td class=text><ul>\n");
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 == 0) {
print(
"<a href=\"javascript: klappe_news('a".$array['id']."')\"><img border=\"0\" src=\"images/minus.png\" id=\"pica".$array['id']."\" alt=\"Megjelenítés/Elrejtés\">&nbsp;" gmdate("Y.m.d",strtotime($array['added'])) . " - " ."<b>"$array['cim'] . "</b></a>($user[username])");
print(
"<div id=\"ka".$array['id']."\"  style=\"display:" . ($array['lathato']=='igen' "block" "none") . "\"> ".format_comment($array["body"],0)." </div> ");
$news_flag 1;
}
else {
print(
"<a href=\"javascript: klappe_news('a".$array['id']."')\"><br><img border=\"0\" src=\"images/plus.png\" id=\"pica".$array['id']."\" alt=\"Megjelenítés/Elrejtés\">&nbsp;" gmdate("Y.m.d",strtotime($array['added'])) . " - " ."<b>"$array['cim'] . "</b></a>($user[username])");
print(
"<div id=\"ka".$array['id']."\"  style=\"display:" . ($array['lathato']=='nem' "block" "none") . "\"> ".format_comment($array["body"],0)." </div> ");
}
if (
get_user_class() >= UC_ADMINISTRATOR)
{
print(
" <font class=normal> &nbsp; [<a class=altlink href=news.php?action=edit&newsid=" $array['id'] . "&returnto=" urlencode($_SERVER['PHP_SELF']) . "><b>Szerkesztés</b></a>]</font>");
print(
" - <font class=normal>[<a class=altlink href=news.php?action=delete&newsid=" $array['id'] . "&returnto=" urlencode($_SERVER['PHP_SELF']) . "><b>Hír törlése</b></a>]</font>"); }
print(
"<div id=\"ka".$array['id']."\" style=\"display: none;\"> ".format_comment($array["body"],0)."</div>");
}
print(
"</ul></td></tr></table>\n");

Thx!
Reply With Quote