<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

根据下级栏目获得顶级栏目名称的SQL语句

时间:2020-12-15

适用于 DEDE5.5,可能会有点影响速度,不过如果你站的数据不大的话可以忽略不计了。
 
代码如下:
{dede:field.typeid runphp='yes'}
$ID = @me;
$sql = "SELECT * FROM `dede_arctype` WHERE id=$ID";
$query = mysql_query($sql);
$row=mysql_fetch_array($query);
$relID = "$row[reid]";
if($relID == 0) {@me = $row[typename];}
else{
$sql = "SELECT `typename` FROM `dede_arctype` WHERE id=$relID";
$query = mysql_query($sql);
$row=mysql_fetch_array($query);
@me = $row[typename];
}
{/dede:field.typeid}
 
==============================================================
以下为更新标签,使用dedesql类操作。
{dede:field.typeid runphp='yes'}
$ID = @me;
global $dsql;
$sql = "SELECT * FROM `dede_arctype` WHERE id=$ID";
$dsql->Execute('a', $sql);
$row = $dsql->GetArray('a');
$relID = "$row[reid]";
if($relID == 0)
{
@me = $row[typename];
}
else{
$sql = "SELECT `typename` FROM `dede_arctype` WHERE id=$relID";
$dsql->Execute('t', $sql);
$row = $dsql->GetArray('t');
 
@me = $row[typename];
}
{/dede:field.typeid}
0
首页
案例
关于
联系