سلام یک سوال داشتم در خصوص بلوک موضوعات نیوک همانطور که میدانید بطور پیشفرض زیر موضوعات نشان داده میشه مانند شکل :
کسی میتونه کمکم کنه که یه تغییراتی در کد بلوک ایجاد کنیم تا بطور پیشفرض زیر موضوعات بسته باشه مانند این عکس:
کد بلوک :
[PHPS]<?php
if (!defined('BLOCK_FILE')) {
Header("Location: index.php");
}
global $prefix, $db, $align;
$ThemeSel = get_theme();
$content = "<script language=\"JavaScript\">
function Toggle2(item) {
obj=document.getElementById(item);
visible=(obj.style.display!=\"none\")
key=document.getElementById(\"2x\" + item);
if (visible) {
obj.style.display=\"none\";
key.innerHTML=\"<img src='images/CZModules/$align/closed.gif' align='absmiddle' border='0'>\";
} else {
obj.style.display=\"block\";
key.innerHTML=\"<img src='images/CZModules/$align/open.gif' align='absmiddle' border='0'>\";
}
}
</script>";
function subtopics($parent_id){
global $prefix, $db, $align, $textalign1;
$result1 = $db->sql_query("SELECT * FROM ".$prefix."_topics WHERE parent_id = '$parent_id' ORDER by topicid");
while($row1 = $db->sql_fetchrow($result1)) {
$topicid1 = intval($row1['topicid']);
$parent_id1 = intval($row1['parent_id']);
$topicname1 = stripslashes($row1['topictext']);
$subrows1 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_topics WHERE parent_id = '$topicid1' ORDER by topicid"));
if($subrows1 > 0){
$subimg1 = "open";
$onclick1 = "onclick=\"Toggle2('$topicname1');\" style=\"cursor
ointer;\"";
}else{
$subimg1 = "arrow";
$onclick1 = "";
}
$content1 .= "<div style=\"direction:$align;margin-$textalign1:20px;\">
<table width=\"100%\"><tr><td width=\"35\" align=\"center\"><a id=\"2x$topicname1\" $onclick1\"><img src=\"images/CZModules/$align/$subimg1.gif\" border=\"0\"></a></td>
<td align=\"$textalign1\"><b><a href=\"modules.php?name=News&new_topic=$topicid1\">$topicname1</a></td></tr><tr><td colspan=\"2\">";
$content1 .= "<div id=\"$topicname1\">";
if($subrows1 > 0){
$content1 .= subtopics($topicid1);
}
$content1 .= "</div></td></tr></table></div>";
}
return $content1;
}
$result = $db->sql_query("SELECT * FROM ".$prefix."_topics WHERE parent_id = '0' ORDER by topicid");
while ($row = $db->sql_fetchrow($result)) {
$topicid = intval($row[topicid]);
$topicname = stripslashes($row[topictext]);
$parent_id = intval($row['parent_id']);
$subrows = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_topics WHERE parent_id = '$topicid' ORDER by topicid"));
if($subrows > 0){
$subimg = "open";
$onclick = "onclick=\"Toggle2('$topicname');\" style=\"cursor
ointer;\"";
}else{
$subimg = "arrow";
$onclick = "";
}
$content .= "<div style=\"direction:$align;\">
<table width=\"100%\"><tr><td width=\"35\" align=\"center\"><a id=\"2x$topicname\" $onclick\"><img src=\"images/CZModules/$align/$subimg.gif\" border=\"0\"></a></td>
<td align=\"$textalign1\"><b><a href=\"modules.php?name=News&new_topic=$topicid\">$topicname</a></td></tr><tr><td colspan=\"2\">";
$content .= "<div id=\"$topicname\">";
if($subrows > 0){
$content .= subtopics($topicid);
}
$content .= "</div></td></tr></table></div>";
}
?>[/PHPS]
لطفا کمکم کیند سعی میکنم جبران کنم...