 {"id":100,"date":"2010-08-08T08:35:06","date_gmt":"2010-08-08T00:35:06","guid":{"rendered":"http:\/\/www.qyuef.com\/?p=100"},"modified":"2010-08-08T08:35:06","modified_gmt":"2010-08-08T00:35:06","slug":"%e7%bb%99%e7%bb%87%e6%a2%a6%e7%9a%84dedechannel%e5%a2%9e%e5%8a%a0%e5%8f%af%e9%80%89%e6%8b%a9%e8%8c%83%e5%9b%b4%e7%9a%84%e5%b1%9e%e6%80%a7","status":"publish","type":"post","link":"http:\/\/www.qyuef.com\/?p=100","title":{"rendered":"\u7ed9\u7ec7\u68a6\u7684dede:channel\u589e\u52a0\u53ef\u9009\u62e9\u8303\u56f4\u7684\u5c5e\u6027"},"content":{"rendered":"<p>\u6700\u8fd1\u505a\u4e00\u4e2a\u95e8\u6237\u7f51\u7ad9\uff0c\u5728\u6709\u7684\u9891\u9053\u9875\u9762\u9700\u8981\u8c03\u7528\u4e00\u4e9b\u6307\u5b9aID\u51e0\u5230\u51e0\u7684\u4e00\u4e9b\u680f\u76ee\u3002\u521a\u5f00\u59cb\u6253\u7b97\u76f4\u63a5\u5c06\u94fe\u63a5\u5199\u6b7b\u5728\u6a21\u7248\u91cc\u3002\u540e\u6765\u89c9\u5f97\u8fd9\u6837\u5bf9\u7a0b\u5e8f\u7684\u6269\u5c55\u6027\u4e0d\u662f\u5f88\u597d\u3002\u5ba2\u6237\u662f\u4e0d\u61c2\u7a0b\u5e8f\u7684\uff0c\u4f60\u4e0d\u80fd\u6307\u671b\u4ed6\u4e5f\u4f1a\u4fee\u6539\u6a21\u7248\u3002\u4e8e\u662f\u5c31\u6709\u4e86\u505a\u8fd9\u6837\u4e00\u4e2a\u5c0f\u529f\u80fd\u7684\u60f3\u6cd5\u3002 \u00a0\u00a0\u00a0\u00a0 \u5728\u539f\u6765\u7684dede:channel\u57fa\u7840\u4e0a\u589e\u52a0\u4e86\u4e00\u4e2alimit\u5c5e\u6027\u3002 limit\u662f\u8d77\u70b9\uff0crow\u662f\u6761\u6570<\/p>\n<p>\u4f7f\u7528\u65b9\u6cd5\uff1a<\/p>\n<p>{dede:channel type=&#8217;son&#8217; limit=&#8217;3&#8242; typeid=&#8217;1&#8242; reid=&#8217;1&#8242; row=&#8217;5&#8242; &#8220;&lt;a href=&#8217;~typelink~&#8217; class=&#8217;thisclass&#8217;&gt;~typename~&lt;\/a&gt; |&#8221;} \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;a href=&#8221;[field:typelink\/]&#8221;&gt;&lt;span class=&#8221;aaa&#8221;&gt;[field:typename\/]&lt;\/span&gt;&lt;\/a&gt; {\/dede:channel}<\/p>\n<p><!--more-->\u5c06\u4e00\u4e0b\u7684\u4ee3\u7801\u590d\u5236\u5230include\/taglib\/channel.lib.php\u4e2d\u8fdb\u884c\u8986\u76d6\uff1a<\/p>\n<pre lang=\"php\" line=\"1\">\nfunction lib_channel(&$ctag,&$refObj)\n{\n\tglobal $dsql;\n\n\t$attlist = \"typeid|0,reid|0,row|100,col|1,type|son,currentstyle|,cacheid|,limit|0\";\n\tFillAttsDefault($ctag->CAttribute->Items,$attlist);\n\textract($ctag->CAttribute->Items, EXTR_SKIP);\n\t$innertext = $ctag->GetInnerText();\n\t$line = empty($row) ? 100 : $row;\n\t\n\t$likeType = '';\n\t\/\/\u8bfb\u53d6\u56fa\u5b9a\u7684\u7f13\u5b58\u5757\n\t$cacheid = trim($cacheid);\n\tif($cacheid !='') {\n\t\t$likeType = GetCacheBlock($cacheid);\n\t\tif($likeType != '') return $likeType;\n\t}\n\n\t$reid = 0;\n\t$topid = 0;\n\t\/\/\u5982\u679c\u5c5e\u6027\u91cc\u6ca1\u6307\u5b9a\u680f\u76eeid\uff0c\u4ece\u5f15\u7528\u7c7b\u91cc\u83b7\u53d6\u680f\u76ee\u4fe1\u606f\n\tif(empty($typeid))\n\t{\n\t\tif( isset($refObj->TypeLink->TypeInfos['id']) )\n\t\t{\n\t\t\t$typeid = $refObj->TypeLink->TypeInfos['id'];\n\t\t\t$reid = $refObj->TypeLink->TypeInfos['reid'];\n\t\t\t$topid = $refObj->TypeLink->TypeInfos['topid'];\n\t\t}\n\t\telse {\n\t  \t$typeid = 0;\n\t  }\n\t}\n\t\/\/\u5982\u679c\u6307\u5b9a\u4e86\u680f\u76eeid\uff0c\u4ece\u6570\u636e\u5e93\u83b7\u53d6\u680f\u76ee\u4fe1\u606f\n\telse\n\t{\n\t\t$row2 = $dsql->GetOne(\"Select * From `#@__arctype` where id='$typeid' \");\n\t\t$typeid = $row2['id'];\n\t\t$reid = $row2['reid'];\n\t\t$topid = $row2['topid'];\n\t\t$issetInfos = true;\n\t}\n\t\n\tif($type=='' || $type=='sun') $type='son';\n\tif($innertext=='') $innertext = GetSysTemplets(\"channel_list.htm\");\n\n\tif($type=='top')\n\t{\n\t\t$sql = \"Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\n\t\t  From `#@__arctype` where reid=0 And ishidden<>1 order by sortrank asc limit $limit, $line \";\n\t}\n\telse if($type=='son')\n\t{\n\t\tif($typeid==0) return '';\n\t\t$sql = \"Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\n\t\t  From `#@__arctype` where reid='$typeid' And ishidden<>1 order by sortrank asc limit $limit, $line \";\n\t}\n\telse if($type=='self')\n\t{\n\t\tif($reid==0) return '';\n\t\t$sql = \"Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\n\t\t\tFrom `#@__arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit $limit, $line \";\n\t}\n\t\/\/And id<>'$typeid'\n\t$needRel = false;\n\t$dtp2 = new DedeTagParse();\n\t$dtp2->SetNameSpace('field','[',']');\n\t$dtp2->LoadSource($innertext);\n\t\/\/\u68c0\u67e5\u662f\u5426\u6709\u5b50\u680f\u76ee\uff0c\u5e76\u8fd4\u56derel\u63d0\u793a\uff08\u7528\u4e8e\u4e8c\u7ea7\u83dc\u5355\uff09\n\tif(ereg(':rel', $innertext)) $needRel = true;\n\t\n\tif(empty($sql)) return '';\n\t$dsql->SetQuery($sql);\n\t$dsql->Execute();\n\t\n\t$totalRow = $dsql->GetTotalRow();\n\t\/\/\u5982\u679c\u7528\u5b50\u680f\u76ee\u6a21\u5f0f\uff0c\u5f53\u6ca1\u6709\u5b50\u680f\u76ee\u65f6\u663e\u793a\u540c\u7ea7\u680f\u76ee\n\tif($type=='son' && $reid!=0 && $totalRow==0)\n\t{\n\t\t$sql = \"Select id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath\n\t\t\tFrom `#@__arctype` where reid='$reid' And ishidden<>1 order by sortrank asc limit $limit, $line \";\n\t\t$dsql->SetQuery($sql);\n\t  $dsql->Execute();\n\t}\n\t$GLOBALS['autoindex'] = 0;\n\tfor($i=0;$i < $line;$i++)\n\t{\n\t\tif($col>1) $likeType .= \"<dl>\\r\\n\";\n\t\tfor($j=0; $j<$col; $j++)\n\t\t{\n\t\t\tif($col>1) $likeType .= \"<dd>\\r\\n\";\n\t\t\tif($row=$dsql->GetArray())\n\t\t\t{\n\t\t\t\t$row['sonids'] = $row['rel'] = '';\n\t\t\t\tif($needRel)\n\t\t\t\t{\n\t\t\t\t\t$row['sonids'] = GetSonIds($row['id'], 0, false);\n\t\t\t\t\tif($row['sonids']=='') $row['rel'] = '';\n\t\t\t\t\telse $row['rel'] = \" rel='dropmenu{$row['id']}'\";\n\t\t\t\t}\n\t\t\t\t\/\/\u5904\u7406\u540c\u7ea7\u680f\u76ee\u4e2d\uff0c\u5f53\u524d\u680f\u76ee\u7684\u6837\u5f0f\n\t\t\t\tif( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' )\n\t\t\t\t{\n\t\t\t\t\t$linkOkstr = $currentstyle;\n\t\t\t\t\t$row['typelink'] = GetOneTypeUrlA($row);\n\t\t\t\t\t$linkOkstr = str_replace(\"~rel~\",$row['rel'],$linkOkstr);\n\t\t\t\t\t$linkOkstr = str_replace(\"~id~\",$row['id'],$linkOkstr);\n\t\t\t\t\t$linkOkstr = str_replace(\"~typelink~\",$row['typelink'],$linkOkstr);\n\t\t\t\t\t$linkOkstr = str_replace(\"~typename~\",$row['typename'],$linkOkstr);\n\t\t\t\t\t$likeType .= $linkOkstr;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row);\n\t\t\t\t\tif(is_array($dtp2->CTags))\n\t\t\t\t\t{\n\t\t\t\t\t\tforeach($dtp2->CTags as $tagid=>$ctag)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif(isset($row[$ctag->GetName()])) $dtp2->Assign($tagid,$row[$ctag->GetName()]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$likeType .= $dtp2->GetResult();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($col>1) $likeType .= \"<\/dd>\\r\\n\";\n\t\t\t$GLOBALS['autoindex']++;\n\t\t}\n\t\t\/\/Loop Col\n\t\tif($col>1)\n\t\t{\n\t\t\t$i += $col - 1;\n\t\t\t$likeType .= \"\t<\/dl>\\r\\n\";\n\t\t}\n\t}\n\t\/\/Loop for $i\n\t$dsql->FreeResult();\n\tif($cacheid !='') {\n\t\tWriteCacheBlock($cacheid, $likeType);\n\t}\n\treturn $likeType;\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u505a\u4e00\u4e2a\u95e8\u6237\u7f51\u7ad9\uff0c\u5728\u6709\u7684\u9891\u9053\u9875\u9762\u9700\u8981\u8c03\u7528\u4e00\u4e9b\u6307\u5b9aID\u51e0\u5230\u51e0\u7684\u4e00\u4e9b\u680f\u76ee\u3002\u521a\u5f00\u59cb\u6253\u7b97\u76f4\u63a5\u5c06\u94fe\u63a5\u5199\u6b7b\u5728\u6a21\u7248\u91cc\u3002\u540e\u6765\u89c9\u5f97\u8fd9\u6837\u5bf9\u7a0b\u5e8f\u7684\u6269\u5c55\u6027\u4e0d\u662f\u5f88\u597d\u3002\u5ba2\u6237\u662f\u4e0d\u61c2\u7a0b\u5e8f\u7684\uff0c\u4f60\u4e0d\u80fd\u6307\u671b\u4ed6\u4e5f\u4f1a\u4fee\u6539\u6a21\u7248\u3002\u4e8e\u662f\u5c31\u6709\u4e86\u505a\u8fd9\u6837\u4e00\u4e2a\u5c0f\u529f\u80fd\u7684\u60f3\u6cd5\u3002 \u00a0\u00a0\u00a0\u00a0 \u5728\u539f\u6765\u7684<a rel=\"nofollow\" class=\"more-link\" style=\"text-decoration:none;\" href=\"http:\/\/www.qyuef.com\/?p=100\">&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[16,93],"tcat":[],"_links":{"self":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/100"}],"collection":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=100"}],"version-history":[{"count":0,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=\/wp\/v2\/posts\/100\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=100"},{"taxonomy":"tcat","embeddable":true,"href":"http:\/\/www.qyuef.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftcat&post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}