View Full Version : оптимизация нюки!!!
ребят!!! давайте делиться способами оптимизации нюки а то ни на одном форуме нет аткого топика !!!!!!
многим хочеться чтобы у них нюка была как слайд))))
что вы об этом думаете?
пожалуй я начну!!! вот ссылка на статью где вы можете убрать очень сного запросов у своего сайта!!! до 20 запросов сделать можете
http://lkrotish.narod.ru/optimize.html
короче установил я все кроме blocks($side) и на главной нюка грузит 49 запросов!!!
под админком и пользователем всего 60 запросов вместо 200!!!
помогите установить то что несмог установить!!! скажите что в этом нето
function blocks($side) {
global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
if ($multilingual == 1) {
$querylang = "AND (blanguage='$currentlang' OR blanguage='')";
} else {
$querylang = "";
}
if (strtolower($side[0]) == "l") {
$pos = "l";
} elseif (strtolower($side[0]) == "r") {
$pos = "r";
} elseif (strtolower($side[0]) == "c") {
$pos = "c";
} elseif (strtolower($side[0]) == "d") {
$pos = "d";
}
$side = $pos;
global $edogs_blocks;
if(empty($edogs_blocks)) {
$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subion, bposition FROM ".$prefix."_blocks WHERE active='1' $querylang ORDER BY weight ASC";
$result = $db->sql_query($sql);
while($row_z = $db->sql_fetchrow($result)) {
$edogs_blocks[]=$row_z;
}
}
foreach($edogs_blocks as $k=>$row) {
if($row['bposition']!=$pos) continue;
$bid = intval($row['bid']);
$title = stripslashes(check_html($row['title'], "nohtml"));
$content = stripslashes($row['content']);
$url = stripslashes($row['url']);
$blockfile = $row['blockfile'];
$view = intval($row['view']);
$expire = intval($row['expire']);
$action = $row['action'];
$action = substr("$action", 0,1);
$now = time();
$sub = intval($row['subion']);
if ($sub == 0 OR ($sub == 1 AND !paid())) {
if ($expire != 0 AND $expire <= $now) {
if ($action == "d") {
$db->sql_query("UPDATE ".$prefix."_blocks SET active='0', expire='0' WHERE bid='$bid'");
return;
} elseif ($action == "r") {
$db->sql_query("DELETE FROM ".$prefix."_blocks WHERE bid='$bid'");
return;
}
}
if ($row[bkey] == admin) {
adminblock();
} elseif ($row[bkey] == userbox) {
userblock();
} elseif ($row[bkey] == "") {
if ($view == 0) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 2 AND is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
}
}
}
}
}
это потимизация мне дала - 15 на главной и в админке было раньше 200 а щас 60
Мне данная инструкция помогла опуститься на несколько запросов, спасибо.
function blocks($side) - тоже не работает
ты смеешься? у меня убрал 15 запросов а админка стала грузиться не 200 запросов а 60!! теперь у меня всего 49 запросов
kor
помогите установить то что несмог установить!!! скажите что в этом нето
так а что требуется то?
в той статье у меня неполучилось вот эта фунуция!! проблема в том что заменяю я стандартную функция этой и у меня негрузятся ни одного блока на айте на главной !! помоги ее подправить чтоб блоки выводились!!! видимо это сжделано для старых нюк или я просто незнаю!
function blocks($side) {
global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
if ($multilingual == 1) {
$querylang = "AND (blanguage='$currentlang' OR blanguage='')";
} else {
$querylang = "";
}
if (strtolower($side[0]) == "l") {
$pos = "l";
} elseif (strtolower($side[0]) == "r") {
$pos = "r";
} elseif (strtolower($side[0]) == "c") {
$pos = "c";
} elseif (strtolower($side[0]) == "d") {
$pos = "d";
}
$side = $pos;
global $edogs_blocks;
if(empty($edogs_blocks)) {
$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subion, bposition FROM ".$prefix."_blocks WHERE active='1' $querylang ORDER BY weight ASC";
$result = $db->sql_query($sql);
while($row_z = $db->sql_fetchrow($result)) {
$edogs_blocks[]=$row_z;
}
}
foreach($edogs_blocks as $k=>$row) {
if($row['bposition']!=$pos) continue;
$bid = intval($row['bid']);
$title = stripslashes(check_html($row['title'], "nohtml"));
$content = stripslashes($row['content']);
$url = stripslashes($row['url']);
$blockfile = $row['blockfile'];
$view = intval($row['view']);
$expire = intval($row['expire']);
$action = $row['action'];
$action = substr("$action", 0,1);
$now = time();
$sub = intval($row['subion']);
if ($sub == 0 OR ($sub == 1 AND !paid())) {
if ($expire != 0 AND $expire <= $now) {
if ($action == "d") {
$db->sql_query("UPDATE ".$prefix."_blocks SET active='0', expire='0' WHERE bid='$bid'");
return;
} elseif ($action == "r") {
$db->sql_query("DELETE FROM ".$prefix."_blocks WHERE bid='$bid'");
return;
}
}
if ($row[bkey] == admin) {
adminblock();
} elseif ($row[bkey] == userbox) {
userblock();
} elseif ($row[bkey] == "") {
if ($view == 0) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 2 AND is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
}
}
}
}
}
Тут же взято почти все ядро от EdogsNuke :(
kor Новости кстати тоже можно переделать чтобы он делали не по 2 запроса на новость а все в 1
почти ты грустишь что взять от едогса? как сделать меньше запросов в нвоостях?
и подскажие может ты еще что нить знаешь как оптимизировать?
kor Вобщем вот берем модуль новостей от нюки 76 на других не пробывал находим там вот это :
if (isset($new_topic)) {
$new_topic = intval($new_topic);
} else {
$new_topic == 0;
}
if (isset($userinfo['setstorynum']) AND $user_news == 1) {
$storynum = $userinfo['setstorynum'];
} else {
$storynum = $storyhome;
}
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic'";
$result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = stripslashes(check_html($row_a['topictext'], "nohtml"));
Заменяем на это:
if (isset($new_topic)) {
$new_topic = intval($new_topic);
} else {
$new_topic == 0;
}
if (isset($cookie[3]) AND $user_news == 1) {
$storynum = $cookie[3];
} else {
$storynum = $storyhome;
}
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR s.catid='0') AND s.time <= NOW()";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic' AND s.time <= NOW()";
$result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = stripslashes(check_html($row_a['topictext'], "nohtml"));
Дальше находим:
$result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $storynum");
while ($row = $db->sql_fetchrow($result)) {
$s_sid = intval($row['sid']);
$catid = intval($row['catid']);
$aid = stripslashes($row['aid']);
$title = stripslashes(check_html($row['title'], "nohtml"));
$time = $row['time'];
$hometext = stripslashes($row['hometext']);
$bodytext = stripslashes($row['bodytext']);
$comments = stripslashes($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = stripslashes($row['informant']);
$notes = stripslashes($row['notes']);
$acomm = intval($row['acomm']);
$score = intval($row['score']);
$ratings = intval($row['ratings']);
if ($catid > 0) {
$row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
$cattitle = stripslashes(check_html($row2['title'], "nohtml"));
}
getTopics($s_sid);
formatTimestamp($time);
заменяем на это:
if ($pagenum == "") { $pagenum = 1; }
$offset = ($pagenum-1) * $storynum;
$offset = intval($offset);
$storynum = intval($storynum);
$sql = "SELECT sid, s.catid, s.aid, s.title, s.time, s.hometext, s.bodytext, s.comments, s.counter, s.topic, s.informant, s.notes, s.acomm, s.score, s.ratings, c.title, t.topicid, t.topicname, t.topicimage, t.topictext, a.email, a.url FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_stories_cat AS c on (s.catid=c.catid) LEFT JOIN ".$prefix."_topics AS t on (s.topic=t.topicid) LEFT JOIN ".$prefix."_authors AS a on (s.aid=a.aid) $qdb $querylang ORDER BY s.time DESC LIMIT $offset, $storynum";
$result = $db->sql_query($sql);
while (list( $s_sid , $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes, $acomm, $score, $ratings, $ctitle, $topicid, $topicname, $topicimage, $topictext, $aemail, $aurl)=$db->sql_fetchrow($result)) {
if ($catid > 0) {
$cattitle = $ctitle;
}
formatTimestamp($time);
все!
Правда тут еще использован кусоек кода от хака pagenum но все впринципе работает я думаю если он кому то мешает то не составит труда вырезать из данного кода лишнее!
праивльно я понял что это надо изменять в модули news index.php
все эти фишки разработаны не мой просто выкладываю то то у меня есть но придумывал все это не я
kor да
не занешь мне стремно что то делать у меня 40% от этого кода несовпадает!!!! я сам нерешусь прикручивать от 76 нюки на 79
kor а как насчет зделать бекап старого файла? и попробывать?
вот теб пример первого изменения и скажи что мне тут менять если из всего тока две строчик совпадает
function theindex($new_topic="0") {
global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $sitename, $user_news, $pagenum, $module_name;
$new_topic = intval($new_topic);
$storynum = 10;
if ($multilingual == 1) {
$querylang = "AND (alanguage='$currentlang' OR alanguage='')";
} else {
$querylang = "";
}
include("header.php");
if (isset($cookie[3])) {
$storynum = $cookie[3];
}
if ($pagenum == "") { $pagenum = 1;}
$offset = ($pagenum-1) * $storynum;
Вот это:
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic'";
$result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = filter($row_a['topictext'], nohtml);
На это
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR s.catid='0') AND s.time <= NOW()";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic' AND s.time <= NOW()";
$result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = stripslashes(check_html($row_a['topictext'], "nohtml"));
поставил и все новости пропали!!!
kor значит не так поставил скорее всего у теб вывод ошибок на экран включен?
диагностику ошибок выклбчил выкладываю тебе index.php модуля новостей помоги мне пожалуйста
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2005 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if (!defined('MODULE_FILE')) {
die ("You can't access this file directly...");
}
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
function theindex($new_topic="0") {
global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $sitename, $user_news, $pagenum, $module_name;
$new_topic = intval($new_topic);
$storynum = 10;
if ($multilingual == 1) {
$querylang = "AND (alanguage='$currentlang' OR alanguage='')";
} else {
$querylang = "";
}
include("header.php");
if (isset($cookie[3])) {
$storynum = $cookie[3];
}
if ($pagenum == "") { $pagenum = 1;}
$offset = ($pagenum-1) * $storynum;
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
} else {
$qdb = "WHERE topic='$new_topic'";
}
$sql_pn = "select COUNT(*) AS pn from ".$prefix."_stories $qdb" ;
$result_pn = $db->sql_query($sql_pn);
$row = $db->sql_fetchrow($result_pn);
$numstories = $row['pn'];
$numpages = ceil($numstories / $storynum);
automated_news();
if (isset($cookie[3]) AND $user_news == 1) {
$storynum = $cookie[3];
} else {
$storynum = $storyhome;
}
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic'";
$result_a = $db->sql_query("SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'");
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = filter($row_a['topictext'], nohtml);
OpenTable();
if ($numrows_a == 0) {
echo "<center><font class=\"title\">$sitename</font><br><br>"._NOINFO4TOPIC."<br><br>[ <a href=\"modules.php?name=News\">"._GOTONEWSINDEX."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
} else {
$db->sql_query("UPDATE ".$prefix."_topics SET counter=counter+1");
echo "<center><font class=\"title\">$sitename: $topic_title</font><br><br>"
."<form action=\"modules.php?name=Search\" method=\"post\">"
."<input type=\"hidden\" name=\"topic\" value=\"$new_topic\">"
.""._SEARCHONTOPIC.": <input type=\"name\" name=\"query\" size=\"30\"> "
."<input type=\"submit\" value=\""._SEARCH."\">"
."</form>"
."[ <a href=\"index.php\">"._GOTOHOME."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
}
CloseTable();
echo "<br>";
}
$result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum");
while ($row = $db->sql_fetchrow($result)) {
$s_sid = intval($row['sid']);
$catid = intval($row['catid']);
$aid = filter($row['aid'], nohtml);
$title = filter($row['title'], nohtml);
$time = $row['time'];
$hometext = filter($row['hometext']);
$bodytext = filter($row['bodytext']);
$comments = intval($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = filter($row['informant'], nohtml);
$notes = filter($row['notes']);
$acomm = intval($row['acomm']);
$score = intval($row['score']);
$ratings = intval($row['ratings']);
if ($catid > 0) {
$row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
$cattitle = stripslashes(check_html($row2['title'], "nohtml"));
}
getTopics($s_sid);
formatTimestamp($time);
$subject = filter($subject, nohtml);
$introcount = strlen($hometext);
$fullcount = strlen($bodytext);
$totalcount = $introcount + $fullcount;
$c_count = $comments;
$r_options = "";
if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
$story_link = "<a href=\"modules.php?name=News&file=article&sid=$s_sid$r_options\">";
$morelink = "(";
if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
$morelink .= "$story_link<b>"._READMORE."</b></a> | ";
} else {
$morelink .= "";
}
if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; }
if ($articlecomm == 1 AND $acomm == 0) {
if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
}
$sid = intval($s_sid);
if ($catid != 0) {
$row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
$title1 = filter($row3['title'], nohtml);
$title = "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\"><font class=\"storycat\">$title1</font></a>: $title";
$morelink .= " | <a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\">$title1</a>";
}
if ($score != 0) {
$rated = substr($score / $ratings, 0, 4);
} else {
$rated = 0;
}
$morelink .= " | "._SCORE." $rated";
$morelink .= ")";
$morelink = str_replace(" | | ", " | ", $morelink);
themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
}
// ¤®Ў*ў«пҐ¬ бва**ЁзЄЁ
if ($numpages > 1) {
echo "<br>";
opentable();
echo "<center>" ;
if ($pagenum > 1) {
$prevpage = $pagenum - 1 ;
$leftarrow = "images/left.gif" ;
if ($new_topic==0){
echo "<a href=\"modules.php?name=$module_name&pagenum=$prevpage\">";
}else{
echo "<a href=\"modules.php?name=$module_name&new_topic=$new_topic&pagenum=$prevpage\">";
}
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
echo "[ " ;
for ($i=1; $i < $numpages+1; $i++) {
if ($i == $pagenum) {
echo "<b>$i</b>";
} else {
if ($new_topic==0){
echo "<a href=\"modules.php?name=$module_name&pagenum=$i\">$i</a>";
} else {
echo "<a href=\"modules.php?name=$module_name&new_topic=$new_topic&pagenum=$i\">$i</a>";
}
}
if ($i < $numpages) { echo " | "; } else { echo " ]"; }
}
if ($pagenum < $numpages) {
$nextpage = $pagenum + 1 ;
$rightarrow = "images/right.gif" ;
if ($new_topic==0){
echo "<a href=\"modules.php?name=$module_name&pagenum=$nextpage\">";
} else {
echo "<a href=\"modules.php?name=$module_name&new_topic=$new_topic&pagenum=$nextpage\">";
}
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
echo "</center>";
closetable();
}
// * вгв §*Є®*зЁ«Ё ¤®Ў*ў«пвм!
include("footer.php");
}
function rate_article($sid, $score, $random_num="0", $gfx_check) {
global $prefix, $db, $ratecookie, $sitename, $r_options, $sitekey, $gfx_chk, $module_name;
if (isset($random_num)) {
$datekey = date("F j");
$rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
$code = substr($rcode, 2, 3);
if (extension_loaded("gd") AND $code != $gfx_check AND $gfx_chk != 0) {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
include("header.php");
title("$sitename: "._ARTICLERATING."");
OpenTable();
$row = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'"));
$row[title] = filter($row[title], nohtml);
echo "<center><a href=\"modules.php?name=$module_name&file=article&sid=$sid$r_options\"><b>$row[title]</b></a><br>"._ARTICLERATING.": <img src=\"images/articles/stars-$score.gif\" border=\"0\" alt=\"$score/5\" title=\"$score/5\"> ($score/5)<br><br>";
echo ""._TOFINISHRATINGERROR."<br><br>";
echo "<form action=\"modules.php?name=$module_name\" method=\"post\">";
echo ""._SECURITYCODE.":<br><img src='?gfx=gfx_little&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'><br><br>\n";
echo ""._TYPESECCODE.":<br><input type=\"text\" NAME=\"gfx_check\" SIZE=\"3\" MAXLENGTH=\"3\"><br>\n";
echo "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\"><br>\n";
echo "<input type=\"hidden\" name=\"score\" value=\"$score\"><br>\n";
echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"rate_article\">";
echo "<input type=\"submit\" value=\""._CASTMYVOTE."\"></font></center></form>";
CloseTable();
include("footer.php");
die();
} else {
$score = intval($score);
$sid = intval($sid);
if ($score) {
if ($score > 5) { $score = 5; }
if ($score < 1) { $score = 1; }
if ($score != 1 AND $score != 2 AND $score != 3 AND $score != 4 AND $score != 5) {
Header("Location: index.php");
die();
}
$ip = $_SERVER["REMOTE_ADDR"];
$num = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_stories WHERE sid='$sid' AND rating_ip='$ip'"));
if ($num != 0) {
Header("Location: modules.php?name=News&op=rate_complete&sid=$sid&rated=1");
die();
}
if (isset($ratecookie)) {
$rcookie = base64_decode($ratecookie);
$rcookie = addslashes($rcookie);
$r_cookie = explode(":", $rcookie);
}
for ($i=0; $i < sizeof($r_cookie); $i++) {
if ($r_cookie[$i] == $sid) {
$a = 1;
}
}
if ($a == 1) {
Header("Location: modules.php?name=News&op=rate_complete&sid=$sid&rated=1");
die();
} else {
$ip = $_SERVER["REMOTE_ADDR"];
$result = $db->sql_query("update ".$prefix."_stories set score=score+$score, ratings=ratings+1, rating_ip='$ip' where sid='$sid'");
$info = base64_encode("$rcookie$sid:");
setcookie("ratecookie","$info",time()+86400);
update_points(7);
Header("Location: modules.php?name=News&op=rate_complete&sid=$sid&score=$score");
}
} else {
include("header.php");
title("$sitename: "._ARTICLERATING."");
OpenTable();
echo "<center>"._DIDNTRATE."<br><br>"
.""._GOBACK."</center>";
CloseTable();
include("footer.php");
}
}
} else {
mt_srand ((double)microtime()*1000000);
$maxran = 1000000;
$random_num = mt_rand(0, $maxran);
if (extension_loaded("gd") AND $gfx_chk != 0 ) {
include("header.php");
title("$sitename: "._ARTICLERATING."");
OpenTable();
$row = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'"));
echo "<center><a href=\"modules.php?name=$module_name&file=article&sid=$sid$r_options\"><b>$row[title]</b></a><br>"._ARTICLERATING.": <img src=\"images/articles/stars-$score.gif\" border=\"0\" alt=\"$score/5\" title=\"$score/5\"> ($score/5)<br><br>";
echo ""._TOFINISHRATING."<br><br>";
echo "<form action=\"modules.php?name=$module_name\" method=\"post\">";
echo ""._SECURITYCODE.":<br><img src='?gfx=gfx_little&random_num=$random_num' border='1' alt='"._SECURITYCODE."' title='"._SECURITYCODE."'><br><br>\n";
echo ""._TYPESECCODE.":<br><input type=\"text\" NAME=\"gfx_check\" SIZE=\"3\" MAXLENGTH=\"3\"><br>\n";
echo "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\"><br>\n";
echo "<input type=\"hidden\" name=\"score\" value=\"$score\"><br>\n";
echo "<input type=\"hidden\" name=\"sid\" value=\"$sid\">\n";
echo "<input type=\"hidden\" name=\"op\" value=\"rate_article\">";
echo "<input type=\"submit\" value=\""._CASTMYVOTE."\"></font></center></form>";
CloseTable();
include("footer.php");
} else {
$random_num = "$random_num";
$gfx_check = "$code";
Header("Location: modules.php?name=$module_name&op=rate_article&sid=$sid&score=$score&random_num=$random_num");
}
}
}
function rate_complete($sid, $rated=0, $score) {
global $sitename, $user, $cookie, $module_name;
$r_options = "";
if (is_user($user)) {
if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
}
include("header.php");
title("$sitename: "._ARTICLERATING."");
OpenTable();
if ($rated == 0) {
$row = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'"));
$row[title] = filter($row[title], nohtml);
echo "<center><a href=\"modules.php?name=$module_name&file=article&sid=$sid$r_options\"><b>$row[title]</b></a><br>"._YOURATEDARTICLE.": <img src=\"images/articles/stars-$score.gif\" border=\"0\" alt=\"$score/5\" title=\"$score/5\"> ($score/5)<br><br>";
echo "<center>"._THANKSVOTEARTICLE."<br><br>"
."[ <a href=\"modules.php?name=$module_name&file=article&sid=$sid$r_options\">"._BACKTOARTICLEPAGE."</a> ]</center>";
} elseif ($rated == 1) {
echo "<center>"._ALREADYVOTEDARTICLE."<br><br>"
."[ <a href=\"modules.php?name=$module_name&file=article&sid=$sid$r_options\">"._BACKTOARTICLEPAGE."</a> ]</center>";
}
CloseTable();
include("footer.php");
}
switch ($op) {
default:
theindex($new_topic);
break;
case "rate_article":
rate_article($sid, $score, $random_num, $gfx_check);
break;
case "rate_complete":
rate_complete($sid, $rated, $score);
break;
}
?>
нц ты включи диагностику ошибок и посмотри то там есть или нет ты оба куска кода заменял как я тебе показывал?
я тебе дал исходник!!! тода поменял и новостей нету!!! при вкл ошибок ничего енпоказывает
ты мне лучше дай имсходник файла где ты уже внес изменения ая посмотрю где не так
что внисить в файл....
я могу только внести вот это поменять!!! а другое слишком многого нехвататет
kor так а тоже ты тогда хочешь стоб были новости у тебя менять нужно оба куска кода которые я тебе давал
посомтри на другой кусок там он никак несовпадает с моим файлом
Вот это
$result = $db->sql_query("SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum");
while ($row = $db->sql_fetchrow($result)) {
$s_sid = intval($row['sid']);
$catid = intval($row['catid']);
$aid = filter($row['aid'], nohtml);
$title = filter($row['title'], nohtml);
$time = $row['time'];
$hometext = filter($row['hometext']);
$bodytext = filter($row['bodytext']);
$comments = intval($row['comments']);
$counter = intval($row['counter']);
$topic = intval($row['topic']);
$informant = filter($row['informant'], nohtml);
$notes = filter($row['notes']);
$acomm = intval($row['acomm']);
$score = intval($row['score']);
$ratings = intval($row['ratings']);
if ($catid > 0) {
$row2 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'"));
$cattitle = stripslashes(check_html($row2['title'], "nohtml"));
}
getTopics($s_sid);
formatTimestamp($time);
Заменить на это
if ($pagenum == "") { $pagenum = 1; }
$offset = ($pagenum-1) * $storynum;
$offset = intval($offset);
$storynum = intval($storynum);
$sql = "SELECT sid, s.catid, s.aid, s.title, s.time, s.hometext, s.bodytext, s.comments, s.counter, s.topic, s.informant, s.notes, s.acomm, s.score, s.ratings, c.title, t.topicid, t.topicname, t.topicimage, t.topictext FROM ".$prefix."_stories AS s LEFT JOIN ".$prefix."_stories_cat AS c on (s.catid=c.catid) LEFT JOIN ".$prefix."_topics AS t on (s.topic=t.topicid) $qdb $querylang ORDER BY s.time DESC LIMIT $offset, $storynum";
$result = $db->sql_query($sql);
while (list($s_sid , $catid, $aid, $title, $time, $hometext, $bodytext, $comments, $counter, $topic, $informant, $notes, $acomm, $score, $ratings, $ctitle, $topicid, $topicname, $topicimage, $topictext) = $db->sql_fetchrow($result)) {
if ($catid > 0) {
$cattitle = $ctitle;
}
formatTimestamp($time);
Все вот все сложности не ленитесь!
все спасибо что помогли тугодуму настроить все!!!! теперь докладываю!!!! было 49 запросов стало 35!!!! большое спасибо!!!
P.s. интересно а что еще можно сделать чтобы добиться 30 запросов или чуть меньше?
У меня вообще совершенно другие функции.
PhpNuke 7.3 Patched 3.1
Andruha как ты видишь из нашей тут переписки то что мне master вообще подал код от нюки 76 но вместе мы довели до 79!!! посомтри весь пост
Вот мой index модуля новостей.
if (isset($new_topic)) - совсем нету т.е. есть но совсем не то.
<?php
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
$index = 1;
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
function theindex($new_topic=0) {
# Page Numbers added $pagenum
global $db, $storyhome, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $articlecomm, $sitename, $user_news, $pagenum;
if ($multilingual == 1) {
$querylang = "AND (alanguage='$currentlang' OR alanguage='')";
} else {
$querylang = "";
}
include("header.php");
automated_news();
if (isset($cookie[3]) AND $user_news == 1) {
$storynum = $cookie[3];
} else {
$storynum = $storyhome;
}
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic'";
$sql_a = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result_a = $db->sql_query($sql_a);
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = $row_a[topictext];
OpenTable();
if ($numrows == 0) {
echo "<center><font class=\"title\">$sitename</font><br><br>"._NOINFO4TOPIC."<br><br>[ <a href=\"modules.php?name=News\">"._GOTONEWSINDEX."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
} else {
echo "<center><font class=\"title\">$sitename: $topic_title</font><br><br>"
."<form action=\"modules.php?name=Search\" method=\"post\">"
."<input type=\"hidden\" name=\"topic\" value=\"$new_topic\">"
.""._SEARCHONTOPIC.": <input type=\"name\" name=\"query\" size=\"30\"> "
."<input type=\"submit\" value=\""._SEARCH."\">"
."</form>"
."[ <a href=\"index.php\">"._GOTOHOME."</a> | <a href=\"modules.php?name=Topics\">"._SELECTNEWTOPIC."</a> ]</center>";
}
CloseTable();
echo "<br>";
}
# START Page Numbers
if ($pagenum == "") { $pagenum = 1 ; }
$offset = ($pagenum-1) * $storynum ;
$sql = "SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum";
# END Page Numbers
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$s_sid = $row['sid'];
$catid = $row[catid];
$aid = $row[aid];
$title = $row[title];
$time = $row[time];
$hometext = $row[hometext];
$bodytext = $row[bodytext];
$comments = $row[comments];
$counter = $row[counter];
$topic = $row[topic];
$informant = $row[informant];
$notes = $row[notes];
$acomm = $row[acomm];
$score = $row[score];
$ratings = $row[ratings];
if ($catid > 0) {
$sql2 = "SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'";
$result2 = $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result2);
$cattitle = $row2[title];
}
getTopics($s_sid);
formatTimestamp($time);
$subject = stripslashes($subject);
$hometext = stripslashes($hometext);
$notes = stripslashes($notes);
$introcount = strlen($hometext);
$fullcount = strlen($bodytext);
$totalcount = $introcount + $fullcount;
$c_count = $comments;
$r_options = "";
if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; }
if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; }
if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; }
if (is_user($user)) {
$the_icons = " | <a href=\"modules.php?name=News&file=print&sid=$s_sid\"><img src=\"images/print.gif\" border=\"0\" alt=\""._PRINTER."\" title=\""._PRINTER."\" width=\"16\" height=\"11\"></a> <a href=\"modules.php?name=News&file=friend&op=FriendSend&sid=$s_sid\"><img src=\"images/friend.gif\" border=\"0\" alt=\""._FRIEND."\" title=\""._FRIEND."\" width=\"16\" height=\"11\"></a>";
} else {
$the_icons = "";
}
$story_link = "<a href=\"modules.php?name=News&file=article&sid=$s_sid$r_options\">";
$morelink = "(";
if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
$morelink .= "$story_link<b>"._READMORE."</b></a> | ";
} else {
$morelink .= "";
}
if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; }
if ($articlecomm == 1 AND $acomm == 0) {
if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; } elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; } elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; }
}
$morelink .= "$the_icons";
$sid = $s_sid;
if ($catid != 0) {
$sql3 = "SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'";
$result3 = $db->sql_query($sql3);
$row3 = $db->sql_fetchrow($result3);
$title1 = $row3[title];
$title = "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\"><font class=\"storycat\">$title1</font></a>: $title";
$morelink .= " | <a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid\">$title1</a>";
}
if ($score != 0) {
$rated = substr($score / $ratings, 0, 4);
} else {
$rated = 0;
}
$morelink .= " | "._SCORE." $rated";
$morelink .= ")";
$morelink = str_replace(" | | ", " | ", $morelink);
themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
}
# START Page Numbers
# Uncomment this next line and change 100 to whatever for number of stories in news and topics for Page Numbers section
#$limitpn = "limit 100"; # limit number of stories
$sql_pn = "select * from ".$prefix."_stories $qdb $querylang $limitpn";
$result_pn = $db->sql_query($sql_pn);
$numstories = $db->sql_numrows($result_pn);
$numpages = ceil($numstories / $storynum);
#if ($numpages > 1 and $new_topic == 0) {
if ($numpages > 1) {
opentable();
echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum "._PERPAGE.")<br>" ;
if ($pagenum > 1) {
$prevpage = $pagenum - 1 ;
$leftarrow = "images/left.gif" ;
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
}
echo "[ " ;
for ($i=1; $i < $numpages+1; $i++) {
if ($i == $pagenum) {
echo "<b>$i</b>";
} else {
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$i\">$i</a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$i\">$i</a>";
}
}
if ($i < $numpages) { echo " | "; } else { echo " ]"; }
}
if ($pagenum < $numpages) {
$nextpage = $pagenum + 1 ;
$rightarrow = "images/right.gif" ;
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
} else {
echo "<a href=\"modules.php?name=News&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
}
}
echo "</center>" ;
closetable();
}
# END Page Numbers in news and topics
include("footer.php");
}
function rate_article($sid, $score) {
global $prefix, $dbi, $ratecookie, $sitename, $r_options;
$score = intval($score);
if ($score) {
if ($score > 5) { $score = 5; }
if ($score < 1) { $score = 1; }
if ($score != 1 AND $score != 2 AND $score != 3 AND $score != 4 AND $score != 5) {
Header("Location: index.php");
die();
}
if (isset($ratecookie)) {
$rcookie = base64_decode($ratecookie);
$r_cookie = explode(":", $rcookie);
}
for ($i=0; $i < sizeof($r_cookie); $i++) {
if ($r_cookie[$i] == $sid) {
$a = 1;
}
}
if ($a == 1) {
Header("Location: modules.php?name=News&op=rate_complete&sid=$sid&rated=1");
} else {
$result = sql_query("update ".$prefix."_stories set score=score+$score, ratings=ratings+1 where sid='$sid'", $dbi);
$info = base64_encode("$rcookie$sid:");
setcookie("ratecookie","$info",time()+3600);
update_points(7);
Header("Location: modules.php?name=News&op=rate_complete&sid=$sid$r_options");
}
} else {
include("header.php");
title("$sitename: "._ARTICLERATING."");
OpenTable();
echo "<center>"._DIDNTRATE."<br><br>"
.""._GOBACK."</center>";
CloseTable();
include("footer.php");
}
}
............ Обрезал ..........
?>
Народ мне кажется вы просто ленитесь вот же эти 2 куска кода которые нужно менять
кусок 1
if ($new_topic == 0) {
$qdb = "WHERE (ihome='0' OR catid='0')";
$home_msg = "";
} else {
$qdb = "WHERE topic='$new_topic'";
$sql_a = "SELECT topictext FROM ".$prefix."_topics WHERE topicid='$new_topic'";
$result_a = $db->sql_query($sql_a);
$row_a = $db->sql_fetchrow($result_a);
$numrows_a = $db->sql_numrows($result_a);
$topic_title = $row_a[topictext];
кусок 2
if ($pagenum == "") { $pagenum = 1 ; }
$offset = ($pagenum-1) * $storynum ;
$sql = "SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum";
# END Page Numbers
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$s_sid = $row['sid'];
$catid = $row[catid];
$aid = $row[aid];
$title = $row[title];
$time = $row[time];
$hometext = $row[hometext];
$bodytext = $row[bodytext];
$comments = $row[comments];
$counter = $row[counter];
$topic = $row[topic];
$informant = $row[informant];
$notes = $row[notes];
$acomm = $row[acomm];
$score = $row[score];
$ratings = $row[ratings];
if ($catid > 0) {
$sql2 = "SELECT title FROM ".$prefix."_stories_cat WHERE catid='$catid'";
$result2 = $db->sql_query($sql2);
$row2 = $db->sql_fetchrow($result2);
$cattitle = $row2[title];
}
getTopics($s_sid);
formatTimestamp($time);
все заменяешь эти куски из твоегофайла теми что я постил!
Master спасибо тебе.
Просто не разобрался до конца. Теперь всё работает, но нумерация страниц пропала.
мастер!!!! есть проблема!!!! короче все поставил но в админке исчезло блок ждут проверки!!! как исправить?
ага, у меня так же !
вот только что заметил.
Andruha возьми хак pagenum и подгони его под этот код возможно просто гдето переменная пропала поновой воткни под мой код этот хак и все!
Andruha Насче пропал блок ждут проверки это совсем не изза моего кода сам посуди какие мы редактировали файлы и откуда грузится блок ждут проверки! блок ждут проверки загружается из mainfile а ты правил чисто индексный файл модуля новостей я тут что то не какой связи не вижу между этим :) вспоминай что ты делал до этого какие изменени вносил до моего кода изза чего мог пропасть блок ждут проверки!
у меня тоже пропало блок ждут проверки я до этого сделал твою оптиизацию+ http://lkrotish.narod.ru/optimize.html можешь глянуть что тут неполучаеться!!! пробую это поставить в mainfile.php заменяя тот что стоит и вообще все пропадает все блоки с главной!!!
и можешь помочь: в этом файле говориться что сделать чтоб оптимизировать нюку но у меня там неполучаеться одна вещь...
помогите установить то что несмог установить!!! скажите что в этом нето
function blocks($side) {
global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
if ($multilingual == 1) {
$querylang = "AND (blanguage='$currentlang' OR blanguage='')";
} else {
$querylang = "";
}
if (strtolower($side[0]) == "l") {
$pos = "l";
} elseif (strtolower($side[0]) == "r") {
$pos = "r";
} elseif (strtolower($side[0]) == "c") {
$pos = "c";
} elseif (strtolower($side[0]) == "d") {
$pos = "d";
}
$side = $pos;
global $edogs_blocks;
if(empty($edogs_blocks)) {
$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subion, bposition FROM ".$prefix."_blocks WHERE active='1' $querylang ORDER BY weight ASC";
$result = $db->sql_query($sql);
while($row_z = $db->sql_fetchrow($result)) {
$edogs_blocks[]=$row_z;
}
}
foreach($edogs_blocks as $k=>$row) {
if($row['bposition']!=$pos) continue;
$bid = intval($row['bid']);
$title = stripslashes(check_html($row['title'], "nohtml"));
$content = stripslashes($row['content']);
$url = stripslashes($row['url']);
$blockfile = $row['blockfile'];
$view = intval($row['view']);
$expire = intval($row['expire']);
$action = $row['action'];
$action = substr("$action", 0,1);
$now = time();
$sub = intval($row['subion']);
if ($sub == 0 OR ($sub == 1 AND !paid())) {
if ($expire != 0 AND $expire <= $now) {
if ($action == "d") {
$db->sql_query("UPDATE ".$prefix."_blocks SET active='0', expire='0' WHERE bid='$bid'");
return;
} elseif ($action == "r") {
$db->sql_query("DELETE FROM ".$prefix."_blocks WHERE bid='$bid'");
return;
}
}
if ($row[bkey] == admin) {
adminblock();
} elseif ($row[bkey] == userbox) {
userblock();
} elseif ($row[bkey] == "") {
if ($view == 0) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 2 AND is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
}
}
}
}
}
это потимизация мне дала - 15 на главной и в админке было раньше 200 а щас 60
Вот это лучше используйте!
function blocks($side) {
global $storynum, $prefix, $multilingual, $currentlang, $db, $admin, $user;
static $barr;
if ($multilingual == 1) {
$querylang = "AND (blanguage='$currentlang' OR blanguage='')";
} else {
$querylang = "";
}
if (strtolower($side[0]) == "l") {
$pos = "l";
} elseif (strtolower($side[0]) == "r") {
$pos = "r";
} elseif (strtolower($side[0]) == "c") {
$pos = "c";
} elseif (strtolower($side[0]) == "d") {
$pos = "d";
}
$side = $pos;
if (!isset($barr)) {
$sql = "SELECT bid, bkey, title, content, url, blockfile, view, expire, action, subscription, bposition FROM ".$prefix."_blocks WHERE active='1' $querylang ORDER BY weight ASC";
$result = $db->sql_query($sql);
while(list($bid, $bkey, $title, $content, $url, $blockfile, $view, $expire, $action, $subscription, $bposition) = $db->sql_fetchrow($result)) {
$bid = intval($bid);
$view = intval($view);
$barr[]= array($bid, $bkey, $title, $content, $url, $blockfile, $view, $expire, $action, $subscription, $bposition);
}
}
for ($i=0; $i<sizeof($barr); $i++){
list ($bid, $bkey, $title, $content, $url, $blockfile, $view, $expire, $action, $subscription, $bposition)=$barr[$i];
if ($bposition==$side){
$now = time();
$sub = intval($subscription);
if ($sub == 0 OR ($sub == 1 AND !paid())) {
if ($expire != 0 AND $expire <= $now) {
if ($action == "d") {
$db->sql_query("UPDATE ".$prefix."_blocks SET active='0', expire='0' WHERE bid='$bid'");
return;
} elseif ($action == "r") {
$db->sql_query("DELETE FROM ".$prefix."_blocks WHERE bid='$bid'");
return;
}
}
if ($bkey == "admin") {
adminblock();
} elseif ($bkey == "userbox") {
userblock();
} elseif ($bkey == "") {
if ($view == 0) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 1 AND is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 2 AND is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
} elseif ($view == 3 AND !is_user($user) || is_admin($admin)) {
render_blocks($side, $blockfile, $title, $content, $bid, $url);
}
}
}
}
}
$db->sql_freeresult($result);
}
поставил и запросы остались на прежнем месте!! но появился блок ждут проверки !!! как говориться запросы неизменились зато все встало на свои места!!!
спасибо тебе благодаря тебе я добился 28 запросов!!!!!!
если нетрудно подскажи что нить еще !!! и глядишь слайд обгоним)))
p.s. я вот хочу убрать новости с главной но немогу белый экран....
kor В админке в модулх выбири какой тебе надо модуль и нажми напротив него ссылку установить на главной и будет другой модуль на гланой а новости будут как просто обыный модуль в менюшке отображаться
у меня на главной 60 запросов, это очень много?
Alexander-V-Sh
01.01.2007, 04:10
это много имхо.
хотя конечно зависит от хоста и кол-ва посетитлей.
это лучше чем 200, но хуже чем 10. (и то и то на нюке бывает)
Alexfilus
01.01.2007, 13:20
у меня минимум 6 было.
MyNuke.ru