This is the smile edge of Hefei Information Technology Co., Ltd. in the Web site when encountered a humble but very difficult to solve the problem.
Post the offending code first:
{loop subcat ($catid) $k $v}
{php $subcatid [] = $k;}
{/loop}
{php $subcatid = implode (', ', $subcatid);}
<?php
$sql = "SELECT * from". Gettablepre (). " Enpicture where status=99 and CatID in ($subcatid) Order by ID DESC ";
? >
{pc:get sql= "$sql" page= "$page" return= "Data"}
{loop $data $r}
<div class= "CAT_PIC_BD" >
<a href= "{$r [url]}" ><p class= picborder2 "></p>
<p>{$r [title]}</p></a>
</div>
{/loop}
{/PC}
This piece of code is the function of the current column of all the sub-columns of information and display, but, no matter how the transfer can not be taken out.
Echo var_dump (subcat ($catid)) returns null;
I'll pull a wipe. Depressed, helpless, doubt is not subcat () function parameter pass wrong, then open phpcms/libs/functions/global.func.php find subcat () function, the code is as follows:
/** *
get sub
-column * @param $parentid parent ID
* @param $type column type
* @param $self contains itself 0 is not included
* @param $siteid Station Point ID
/function subcat ($parentid = null, $type = null, $self = ' 0 ', $siteid = ') {
if (empty ($siteid)) $siteid = Get_siteid ();
$category = GetCache (' Category_content_ '. $siteid, ' Commons ');
foreach ($category as $id => $cat) {
if ($cat [' siteid '] = = $siteid && ($parentid = = NULL | | $cat [' parentid '] = $parentid) && ($type = = NULL | | | $cat [' type '] = = $type)] $subcat [$id] = $cat;
if ($self = = 1 && $cat [' catid '] = = $parentid &&! $cat [' child ']) $subcat [$id] = $cat;
}
return $subcat;
}
Dumbfounded, sure enough, the parameters passed incorrectly. The column type and site ID are not delivered, and after the station cluster function is turned on, the station must pass the $siteid parameter. The modified code is as follows:
{Loop subcat ($catid, 0,0, $siteid) $k $v}
{php $subcatid [] = $k;}
{/loop}
{php $subcatid = implode (', ', $subcatid);}
<?php
$sql = "SELECT * from". Gettablepre (). " Enpicture where status=99 and CatID in ($subcatid) Order by ID DESC ";
? >
{pc:get sql= "$sql" page= "$page" return= "Data"}
{loop $data $r}
<div class= "CAT_PIC_BD" >
<a href= "{$r [url]}" ><p class= picborder2 "></p>
<p>{$r [title]}</p></a>
</div>
{/loop}
{/PC}
Perfect solution to the problem.
Hefei Network Company to find Smile edge information technology, Welcome to exchange.