{"id":130,"date":"2006-07-29T20:08:05","date_gmt":"2006-07-29T12:08:05","guid":{"rendered":"http:\/\/twycf.com\/wordpress\/archives\/130"},"modified":"2006-07-29T20:08:05","modified_gmt":"2006-07-29T12:08:05","slug":"%e4%b8%bb%e9%81%b8%e5%96%ae%e7%94%9f%e6%88%90%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/twycf.com\/?p=130","title":{"rendered":"\u4e3b\u9078\u55ae\u751f\u6210\u5206\u6790"},"content":{"rendered":"<p>\u7cfb\u7d71\u4e3b\u9078\u55ae\u662f\u5982\u4f55\u7522\u751f\u7684\u5462\uff0c\u4e0b\u9762\u662f\u5206\u6790\u6b65\u9a5f<br \/>\n\u7531 index.php \u5f15\u5165 header.php \u958b\u59cb<!--more--><br \/>\n\/header.php<br \/>\n<coolcode linenum=\"off\">  \/\/ Get blocks<br \/>\n  $block_handler =&#038; xoops_gethandler(&#8216;block&#8217;);(\u8a3b1)<br \/>\n  $block_handler->assignBlocks();<\/coolcode><br \/>\n\/kernel\/block.php<br \/>\n<coolcode>  function assignBlocks() \/\/\u53d6\u5f97\u5340\u584a\u4f9b\u6a23\u677f\u5f15\u64ce\u4f7f\u7528<br \/>\n  $bcontent = $xoopsTpl->fetch( &#8220;db:$btpl&#8221;, &#8220;blk_$instanceid&#8221; );\/\/\u53d6\u5f97\u5340\u584a\u5167\u5bb9\uff0c\u7d93\u7531 smarty \u57f7\u884c system_blocks.php<br \/>\n  $xoopsTpl->clear_assign(&#8216;block&#8217;);<br \/>\n  $querycount = count( $xoopsLogger->queries[$xoopsLogger->context] ) &#8211; $querycountbefore;<br \/>\n  $xoopsLogger->addBlock( $block_arr[$i]->block->getVar(&#8216;name&#8217;), false, 0, $querycount );<br \/>\n\/\/$block_arr[$i]->block->getVar(&#8216;name&#8217;)  \u5340\u584a\u540d\u7a31<br \/>\n<\/coolcode><br \/>\n<coolcode linenum=\"off\"><br \/>\n\u8cc7\u6599\u5eab\u53c3\u8003\u8cc7\u6599 table:xoops_block_instance<br \/>\ninstid bid options  title    side weight visible bctime<br \/>\n     1   1 a:0:{} \u4f7f\u7528\u8005\u9078\u55ae    0      0       1      0<br \/>\n     2   2 a:0:{} \u767b\u5165          0      0       1      0<br \/>\n     3   5 a:0:{} \u4e3b\u9078\u55ae        0      0       1      0<\/coolcode><br \/>\n\/modules\/system\/blocks\/system_blocks.php<strong>(\u8a3b2)<\/strong><br \/>\n<coolcode>  function b_system_main_show(){<br \/>\n     $module_handler =&#038; xoops_gethandler(&#8216;module&#8217;);<strong>(\u8a3b1)<\/strong>\/\/\u53d6\u5f97\u6a21\u7d44\u7269\u4ef6(xoops_config, xoops_session, privileges(user,group), modules, config, \u9078\u55ae\u5340\u584a)<br \/>\n     $modules =&#038; $module_handler->getObjects($criteria, true);\/\/\u53d6\u5f97\u8a72\u6a21\u7d44\u7269\u4ef6\u4e0b\u7684\u9078\u55ae\u8cc7\u6599(\u5728\u6b64\u53ea\u6ce8\u610f\u4e3b\u9078\u55ae\u5340\u584a)<br \/>\n    foreach (array_keys($modules) as $i) {<br \/>\n        if (in_array($i, $read_allowed)) {<br \/>\n            $block[&#8216;modules&#8217;][$i][&#8216;name&#8217;] = $modules[$i]->getVar(&#8216;name&#8217;);\/\/\u6a21\u7d44\u540d\u7a31<br \/>\n            $block[&#8216;modules&#8217;][$i][&#8216;name&#8217;] = $modules[$i]->getVar(&#8216;name&#8217;);<br \/>\n<\/coolcode><br \/>\n<coolcode linenum=\"off\"><br \/>\n\u8cc7\u6599\u5eab\u53c3\u8003\u8cc7\u6599 table:xoops_block_module_link<br \/>\nblock_id  module_id  pageid<br \/>\n       6          0       0<br \/>\n       6          2       0<br \/>\n       6          3       0<br \/>\n       6          4       0<br \/>\n       6          5       0<br \/>\n       6          6       0<\/coolcode><br \/>\n\u88dc\u5145\u8aaa\u660e<br \/>\n<strong>\u8a3b1<\/strong>:\u547c\u53eb &#038;xoops_gethandler \u6642\uff0c\u90fd\u6703\u52d5\u614b\u8f09\u5165\u76f8\u5c0d\u61c9\u7684\u7269\u4ef6<br \/>\n\/includes\/functions.php<br \/>\n<coolcode><br \/>\n\tfunction &#038;xoops_gethandler($name, $optional = false )<br \/>\n        if ( file_exists( $hnd_file = XOOPS_ROOT_PATH.&#8217;\/kernel\/&#8217;.$name.&#8217;.php&#8217; ) ) {\/\/\u8f09\u5165 {module}.php<br \/>\n        if (class_exists($class)) {<br \/>\n            $handlers[$name] =&#038; new $class($GLOBALS[&#8216;xoopsDB&#8217;]);<br \/>\n            $handlers[$name] =&#038; new XoopsModuleHandler(object(xoopsmysqldatabaseproxy));<br \/>\n        }<\/coolcode><br \/>\n<strong>\u8a3b2<\/strong>:\u70ba\u4ec0\u9ebc\u4e0a\u9762\u8ffd\u5230\u4e00\u534a\uff0c\u6703\u8dd1\u53bb b_system_main_show() \u53bb\u5462?\u539f\u56e0\u5982\u4e0b<br \/>\n<coolcode><br \/>\n\u8cc7\u6599\u5eab\u53c3\u8003\u8cc7\u6599 table:xoops_newblocks<br \/>\nbid mid           options   name isactive dirname         func_file          show_func         edit_func template<br \/>\n  5   1 a:1:{i:0;s:0:&#8221;&#8221;;} \u4e3b\u9078\u55ae        1  system system_blocks.php b_system_main_show system_block_mainmenu.html<\/coolcode><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7cfb\u7d71\u4e3b\u9078\u55ae\u662f\u5982\u4f55\u7522\u751f\u7684\u5462\uff0c\u4e0b\u9762\u662f\u5206\u6790\u6b65\u9a5f \u7531 index.php \u5f15\u5165 header.php \u958b\u59cb<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-130","post","type-post","status-publish","format-standard","hentry","category-xoops"],"_links":{"self":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts\/130","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=130"}],"version-history":[{"count":0,"href":"https:\/\/twycf.com\/index.php?rest_route=\/wp\/v2\/posts\/130\/revisions"}],"wp:attachment":[{"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/twycf.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}