002 |
function lib_channel(&$ctag,&$refObj) |
004 |
global $_sys_globals,$envs,$dsql; |
005 |
$attlist = "typeid|0,reid|0,row|100,col|1,type|son,currentstyle|" ; |
006 |
FillAttsDefault($ctag->CAttribute->Items,$attlist); |
007 |
extract($ctag->CAttribute->Items, EXTR_SKIP); |
008 |
$innertext = $ctag->GetInnerText(); |
009 |
if (empty($typeid) && $envs[ 'typeid' ]!=0) |
011 |
$typeid = $envs[ 'typeid' ]; |
012 |
$reid = $envs[ 'reid' ]; |
017 |
if ($ type == '' ||$ type == 'sun' ) $ type = "son" ; |
018 |
if ($innertext== '' ) $innertext = GetSysTemplets( "channel_list.htm" ); |
020 |
if ($reid==0 && $typeid>0) |
022 |
$dbrow = $dsql->GetOne( "Select reid From dede_arctype where id='$typeid' " ); |
023 |
if (is_array($dbrow)) $reid = $dbrow[ 'reid' ]; |
029 |
$sql = "Select id ,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description |
030 |
From dede_arctype where reid=0 And ishidden<>1 order by sortrank asc limit 0,$row"; |
032 |
else if ($ type == "son" ) |
034 |
// if ($_sys_globals[ 'typeid' ]>0) $typeid = $_sys_globals[ 'typeid' ]; |
038 |
$sql = "Select id ,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description |
039 |
From dede_arctype where reid= '$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; |
041 |
else if ($ type == "self" ) |
046 |
$sql = "Select id ,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description |
047 |
From `dede_arctype` where reid= '$reid' And ishidden<>1 order by sortrank asc limit 0,$row"; |
050 |
$dtp2 = new DedeTagParse(); |
051 |
$dtp2->SetNameSpace( "field" , "[" , "]" ); |
052 |
$dtp2->LoadSource($innertext); |
053 |
$dsql2 = clone $dsql; |
054 |
$dsql->SetQuery($sql); |
059 |
for ($i=0;$i < $line;$i++) |
061 |
if ($col>1) $likeType .= "<dl>\r\n" ; |
062 |
for ($j=0;$j<$col;$j++) |
064 |
if ($col>1) $likeType .= "<dd>\r\n" ; |
065 |
if ($row=$dsql->GetArray()) |
067 |
if ($ type == 'self' && $row[ 'id' ]==$typeid) //处理同级栏目中,当前栏目的样式 |
069 |
if ($currentstyle!= '' ) |
071 |
$linkOkstr = $currentstyle; |
072 |
$row[ 'typelink' ] = GetOneTypeUrlA($row); |
073 |
$linkOkstr = str_replace( "~typelink~" ,$row[ 'typelink' ],$linkOkstr); |
074 |
$linkOkstr = str_replace( "~typename~" ,$row[ 'typename' ],$linkOkstr); |
075 |
$likeType .= $linkOkstr; |
079 |
$row[ 'typelink' ] = $row[ 'typeurl' ] = GetOneTypeUrlA($row); |
080 |
if (is_array($dtp2->CTags)) |
082 |
foreach($dtp2->CTags as $tagid=>$ctag){ |
083 |
if (isset($row[$ctag->GetName()])) |
085 |
$dtp2->Assign($tagid,$row[$ctag->GetName()]); |
087 |
elseif ( 'sonchannel' == $ctag->GetName()) |
089 |
$dtp2->Assign($tagid,lib_channel_son($ctag,$row[ 'id' ],$dsql2)); |
093 |
$likeType .= $dtp2->GetResult(); |
096 |
if ($col>1) $likeType .= "</dd>\r\n" ; |
097 |
$GLOBALS[ 'autoindex' ]++; |
102 |
$likeType .= " </dl>\r\n" ; |
109 |
function lib_channel_son($ctag,$typeid = 0,$dsql2) |
111 |
$attlist = "row|100,col|1,currentstyle|" ; |
112 |
FillAttsDefault($ctag->CAttribute->Items,$attlist); |
113 |
extract($ctag->CAttribute->Items, EXTR_SKIP); |
114 |
$innertext = $ctag->GetInnerText(); |
118 |
// if ($_sys_globals[ 'typeid' ]>0) $typeid = $_sys_globals[ 'typeid' ]; |
122 |
$sql = "Select id ,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath,description |
123 |
From dede_arctype where reid= '$typeid' And ishidden<>1 order by sortrank asc limit 0,$row"; |
125 |
$dtp2 = new DedeTagParse(); |
126 |
$dtp2->SetNameSpace( "field" , "[" , "]" ); |
127 |
$dtp2->LoadSource($innertext); |
128 |
$dsql2->SetQuery($sql); |
132 |
for ($i=0;$i < $line;$i++) |
134 |
if ($col>1) $likeType .= "<dl>\r\n" ; |
135 |
for ($j=0;$j<$col;$j++) |
137 |
if ($col>1) $likeType .= "<dd>\r\n" ; |
138 |
if ($row=$dsql2->GetArray()) |
140 |
$row[ 'typelink' ] = $row[ 'typeurl' ] = GetOneTypeUrlA($row); |
141 |
if (is_array($dtp2->CTags)) |
143 |
foreach($dtp2->CTags as $tagid=>$ctag){ |
144 |
if (isset($row[$ctag->GetName()])) |
146 |
$dtp2->Assign($tagid,$row[$ctag->GetName()]); |
148 |
elseif ( 'sonchannel' == $ctag->GetName()) |
150 |
$dtp2->Assign($tagid,lib_channel_son($ctag,$row[ 'id' ],$dsql2)); |
154 |
$likeType .= $dtp2->GetResult(); |
156 |
if ($col>1) $likeType .= "</dd>\r\n" ; |
161 |
$likeType .= " </dl>\r\n" ; |
164 |
$dsql2->FreeResult(); |
|