Вход

View Full Version : показывать блоки только в отдельных модулях


vovka
23.02.2006, 11:52
подскажите пожалуйста, как сделать чтобы блоки показывались только в двух модулях, а в осталных не отображались

Soniks
24.02.2006, 00:28
делайте по анологии http://forum.mynuke.ru/showpost.php?p=1837 только немного подругому, вместо Forums пишийте свой модуль
if($module_name =="Modul1" or $module_name =="Modul2")

vovka
01.03.2006, 15:12
спасибо!!!

Erixon
02.03.2006, 01:47
Soniks, для одного модуля у меня работает, а вот для двух нет.
if($module_name =="Modul1" or $module_name =="Modul2")

Так же не работает и вот это

global $module_name;
if (!$home) {
blocks(left);
}
echo "</td><td>\n";
global $module_name;
if (!$home) {
blocks(right);
}

Erixon
03.03.2006, 01:37
Вот сам нашел, если кому интересно
global $module_name, $home;
if ($home) {
blocks(left);
}
echo "</td><td>\n";
global $module_name, $home;
if ($home) {
blocks(right);

dj_spaceman
09.09.2006, 14:52
вообщем, таким способом у меня убираются только левые блоки, а вот правые не как не хотят, правых нету только на форуме
а мне надо что бы были левые блоки в некоторых модулях, а правых не было.
блин! квак быть? что тока не перепробывал.

Soniks
10.09.2006, 09:53
dj_spaceman http://forum.mynuke.ru/search.php?searchid=8722

isic
09.03.2007, 13:58
Подскажите пожалуйста что делать но у меня не получаеться сделать так что бы правые блоки на форуме не отоброжались
***********************************************************/
/* Function themeheader() */
/* */
/* Control the header for your site. You need to define the */
/* BODY tag and in some part of the code call the blocks */
/* function for left side with: blocks(left); */
/************************************************************/

function themeheader() {
global $dbi, $startdate, $user_prefix, $prefix, $thewidth, $thename, $bgcolor5, $user, $banners, $sitename, $slogan, $cookie;
cookiedecode($user);
$username = $cookie[1];
if ($username == "") {
$username = $anonymous;
}
echo "<body topmargin=\"2\" leftmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#000000\" vlink=\"#000000\" alink=\"#000000\">\n";
if ($banners) {
include("banners.php");
}
echo "<center>\n"
."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">\n"
." <tr>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toplefti.gif\" width=\"4\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/topi.gif\"><img border=\"0\" src=\"themes/$thename/images/topi.gif\" width=\"152\" height=\"4\"></td>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toprighti.gif\" width=\"4\" height=\"4\"></td>\n"
."</tr>\n<tr>\n"
." <td background=\"themes/$thename/images/midlefti.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midlefti.gif\" width=\"4\" height=\"30\"></td>\n"
." <td width=\"100%\" class=\"blockitem\" align=\"center\" ><a href=\"http://www.gadjiev.com\"> <img border=\"0\" src=\"themes/$thename/images/logo.jpg\"></td></a>\n"
." <td background=\"themes/$thename/images/midrighti.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midrighti.gif\" width=\"4\" height=\"30\"></td>\n"
."</tr>\n<tr>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botlefti.gif\" width=\"4\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/boti.gif\"><img border=\"0\" src=\"themes/$thename/images/boti.gif\" width=\"152\" height=\"4\"></td>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botrighti.gif\" width=\"4\" height=\"4\"></td>\n"
."</tr>\n"
."</table>\n</center>\n"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<center>\n<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">\n"
." <tr>\n"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/toplefta.gif\" width=\"20\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/top.gif\"><img border=\"0\" src=\"themes/$thename/images/top.gif\" width=\"136\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/top.gif\"><img border=\"0\" src=\"themes/$thename/images/top.gif\" width=\"136\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/top.gif\"><img border=\"0\" src=\"themes/$thename/images/top.gif\" width=\"136\" height=\"4\"></td>\n"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/toprighta.gif\" width=\"20\" height=\"4\"></td>\n"
." </tr>\n"
." <tr>\n"
." <td background=\"themes/$thename/images/midlefta.gif\" width=\"20\"><img border=\"0\" src=\"themes/$thename/images/midlefta.gif\" width=\"20\" height=\"14\"></td>\n"
." <td align=\"left\" class=\"boxtitle\" width=\"33%\"><b>\n";
if ($username == $anonymous) {
echo "&nbsp;<a href=\"modules.php?name=Your_Account&op=new_user\" class=\"header\">"._NEWUSER."</a></b> / <b><a href=\"modules.php?name=Your_Account\" class=\"header\">"._LOGIN."</a>\n";
} else {
echo "&nbsp;"._TWELCOME." $username: <a href=\"modules.php?name=Your_Account\" class=\"header\">".Âàø_Àêóàíò."</a> | <a href=\"modules.php?name=Your_Account&op=logout\" class=\"header\">"._LOGOUT."</a>";
}
echo "</b></td>\n"
." <td align=\"center\" class=\"boxtitle\" width=\"34%\"><b>\n";
$result = sql_query("select type, var, count from $prefix"._counter." order by type desc", $dbi);
while(list($type, $var, $count) = sql_fetch_row($result, $dbi)) {
if(($type == "total") && ($var == "hits")) {
$total = $count;
echo "<marquee scrollamount=\"10\" scrolldelay=\"200\" width=\"100%\" height=\"50%\" direction=\"left\" behavior=\"scroll\" >Àññàëàìó Àëëàéêóì âà ðàõìàòyëëàhè óà áàðàêààòyh.Äîðîãèå Áðàòüÿ è Ѹñòðû.Àóçó áèëëÿhè ìèíàøøàéòààíè ð-ðàäæèì.Áèñìèëëÿhè ð-ðàhìààíè ð-ðàhèì </marquee>";

/* echo ""._WERECEIVED." $total "._PAGESVIEWS." $startdate\n";
*/ }
}
echo "</b></td>\n"
."<td align=\"right\" class=\"boxtitle\" width=\"33%\"><b>\n";
$numrows = sql_num_rows(sql_query("select uid from $user_prefix"._users."", $dbi), $dbi);
echo "".Äîáðî." $numrows ".Ïîæàëîâàòü."&nbsp;</b></td>\n"
."<td background=\"themes/$thename/images/midrighta.gif\" width=\"20\"><img border=\"0\" src=\"themes/$thename/images/midrighta.gif\" width=\"20\" height=\"14\"></td>\n"
."</tr>\n"
."<tr>\n"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/botlefta.gif\" width=\"20\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/bot.gif\"><img border=\"0\" src=\"themes/$thename/images/bot.gif\" width=\"136\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/bot.gif\"><img border=\"0\" src=\"themes/$thename/images/bot.gif\" width=\"136\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/bot.gif\"><img border=\"0\" src=\"themes/$thename/images/bot.gif\" width=\"136\" height=\"4\"></td>\n"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/botrighta.gif\" width=\"20\" height=\"4\"></td>\n"
."</tr>\n"
."</table>\n"
."</center>\n"
."<!-- END HEADER -->\n"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\" width=\"160\" valign=\"top\">\n";
blocks(left);


echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td width=100%>\n";


}

/************************************************************/
/* Function themefooter() */
/* */
/* Control the footer for your site. You don't need to */
/* close BODY and HTML tags at the end. In some part call */
/* the function for right blocks with: blocks(right); */
/* Also, $index variable need to be global and is used to */
/* determine if the page your're viewing is the Homepage or */
/* and internal one. */
/************************************************************/

function themefooter() {
global $thename, $thewidth, $index, $bgcolor5;

echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";

blocks(right);
echo "</td></tr></table></td></tr></table>"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<center>"
."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">"
." <tr>"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/toplefta.gif\" width=\"20\" height=\"4\"></td>"
." <td background=\"themes/$thename/images/top.gif\"><img border=\"0\" src=\"themes/$thename/images/top.gif\" width=\"136\" height=\"4\"></td>"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toprighta.gif\" width=\"20\" height=\"4\"></td>"
." </tr>"
." <tr>"
." <td background=\"themes/$thename/images/midlefta.gif\" width=\"20\"><img border=\"0\" src=\"themes/$thename/images/midlefta.gif\" width=\"20\" height=\"14\"></td>"
." <td align=\"center\" class=\"boxtitle\">&nbsp;</td>"
." <td background=\"themes/$thename/images/midrighta.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midrighta.gif\" width=\"20\" height=\"14\"></td>"
." </tr>"
." <tr>"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/botlefta.gif\" width=\"20\" height=\"4\"></td>"
." <td background=\"themes/$thename/images/bot.gif\"><img border=\"0\" src=\"themes/$thename/images/bot.gif\" width=\"136\" height=\"4\"></td>"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botrighta.gif\" width=\"20\" height=\"4\"></td>"
." </tr>"
."</table>"
."</center>"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">\n"

." <tr>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toplefti.gif\" width=\"4\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/topi.gif\"><img border=\"0\" src=\"themes/$thename/images/topi.gif\" width=\"152\" height=\"4\"></td>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toprighti.gif\" width=\"4\" height=\"4\"></td>\n"
."</tr>\n"




}
Ну у меня выводить белый экран когда я делаю как написано подскажите что я не так делаю может Вы напишете куда что ставить.

Astrix
09.03.2007, 15:33
В функции themefooter (function themefooter() { ) найдите строчку blocks(right); и замените ее на следующий код:

if ($name != 'Forums') {
blocks('right');
}

isic
09.03.2007, 17:14
Не помогает делаю вот так function themefooter() {
global $thename, $thewidth, $index, $bgcolor5;
if($module_name == "Forums") {
echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";


} else {

blocks('right');
} ;
echo "</td></tr></table></td></tr></table>"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<center>"
."<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">"
." <tr>"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/toplefta.gif\" width=\"20\" height=\"4\"></td>"
." <td background=\"themes/$thename/images/top.gif\"><img border=\"0\" src=\"themes/$thename/images/top.gif\" width=\"136\" height=\"4\"></td>"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toprighta.gif\" width=\"20\" height=\"4\"></td>"
." </tr>"
." <tr>"
." <td background=\"themes/$thename/images/midlefta.gif\" width=\"20\"><img border=\"0\" src=\"themes/$thename/images/midlefta.gif\" width=\"20\" height=\"14\"></td>"
." <td align=\"center\" class=\"boxtitle\">&nbsp;</td>"
." <td background=\"themes/$thename/images/midrighta.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midrighta.gif\" width=\"20\" height=\"14\"></td>"
." </tr>"
." <tr>"
." <td width=\"20\"><img border=\"0\" src=\"themes/$thename/images/botlefta.gif\" width=\"20\" height=\"4\"></td>"
." <td background=\"themes/$thename/images/bot.gif\"><img border=\"0\" src=\"themes/$thename/images/bot.gif\" width=\"136\" height=\"4\"></td>"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botrighta.gif\" width=\"20\" height=\"4\"></td>"
." </tr>"
."</table>"
."</center>"
."<table width=\"$thewidth\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" bgcolor=\"$bgcolor5\" align=\"center\"><tr valign=top>\n"
."<td bgcolor=\"$bgcolor5\"><img src=\"themes/$thename/images/pixel.gif\" width=\"1\" height=\"10\" border=\"0\"></td></tr></table>\n"
."<center><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"$thewidth\">\n"

." <tr>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toplefti.gif\" width=\"4\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/topi.gif\"><img border=\"0\" src=\"themes/$thename/images/topi.gif\" width=\"152\" height=\"4\"></td>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/toprighti.gif\" width=\"4\" height=\"4\"></td>\n"
."</tr>\n"

."<tr>\n"
." <td background=\"themes/$thename/images/midlefti.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midlefti.gif\" width=\"4\" height=\"30\"></td>\n"
." <td class=\"boxcontent\" align=\"center\">\n";
footmsg();
echo " </td>\n"
." <td background=\"themes/$thename/images/midrighti.gif\" width=\"4\"><img border=\"0\" src=\"themes/$thename/images/midrighti.gif\" width=\"4\" height=\"30\"></td>\n"
."</tr>\n"

."<tr>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botlefti.gif\" width=\"4\" height=\"4\"></td>\n"
." <td background=\"themes/$thename/images/boti.gif\"><img border=\"0\" src=\"themes/$thename/images/boti.gif\" width=\"152\" height=\"4\"></td>\n"
." <td width=\"4\"><img border=\"0\" src=\"themes/$thename/images/botrighti.gif\" width=\"4\" height=\"4\"></td>\n"
."</tr>\n"

."</table></center>\n";

}
Вместо этого исчезают полностью и везде правые блоки. ставлю по другому правые блоки как были так и остаються замучалься я честное слово с этим.

Astrix
09.03.2007, 17:42
Замените код:

global $thename, $thewidth, $index, $bgcolor5;
if($module_name == "Forums") {
echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";
} else {
blocks('right');
} ;

на следую щий код:

global $thename, $thewidth, $index, $bgcolor5, $module_name, $name;
if($module_name == 'Forums' || $name == 'Forums') {
echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";
} elseif ($index == 1 || defined('INDEX_FILE')) {
blocks('right');
};

Действие: правые блоки никогда не будут отображаться на форуме. Также наличие или отсутствие правых блоков будет зависеть от того, предусмотрены ли они конкретным модулем. Должно работать на 100%.

isic
09.03.2007, 18:07
Млин всё хорошо на форуме правые блоки исчезли но за то в других модулях в которых нужны правые блоки они сьехали вниз. Что надо исправить У меня сейчас там такой код

global $thename, $thewidth, $index, $bgcolor5, $module_name, $name;
if($module_name == 'Forums' || $name == 'Forums') {
echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";
}else{
blocks('right');
};

Всё разобрался млин выкладываю код если кому пригодиться



function themefooter() {
global $thename, $thewidth, $index, $bgcolor5, $module_name, $name;
if($module_name == 'Forums' || $name == 'Forums') {
}else{
echo "</td><td><img src=themes/$thename/images/pixel.gif width=15 height=1 border=0></td><td align=\"right\" valign=\"top\" bgcolor=\"$bgcolor5\">";
blocks('right');
};
Вы не поверите два дня мудохалься.