帝国cms调用后台模型字段初始值

image.png

实现方式参考:

 <div class="fenlei_n">
            <div class="bcat-wrap"><label class="cat-pre-notice">分类&nbsp;:</label><ul class="bcat-menu-wrap"><li><a class="bcat-menu-a <?php echo ($cat==0)?'current':'';?>" href="<?=$public_r['newsurl']?>pptpeitu" >全部</a></li>
<?php
//查询出某个模型cat字段的初始值
$fr=$empire->fetch1("select fvalue from {$dbtbpre}enewsf where f='cat' and tbname='peitu'");
$astr=explode('|',$fr['fvalue']);
$a=array();
$n=0;
foreach ($astr as $v){
    $av=explode('==',$v);
$n++;
if($n>12)break;
?>
                    <li><a class="bcat-menu-a <?php echo ($cat==$av[0])?'current':'';?>" href="<?=$public_r['newsurl']?>pt-[!--self.classid--]-<?=$av[0]?>-0-<?=$fileformat?>-<?=$orderby?>-<?=$title?>-0.html"><?=$av[1]?></a></li>

   <?php } ?>

最终前台实现的展示效果

image.png

另外内容页的调用方式

<?php
$r=$empire->fetch1("select `fvalue` from {$dbtbpre}enewsf where f='hangye' and tid={$class_r[$navinfor['classid']]['modid']}");
preg_match('#\\|'.$navinfor['hangye'].'==([^\\|]+)#','|'.$r['fvalue'].'|',$match);
echo $match[1];?>


支付宝扫码打赏 微信扫码打赏

如果本文对你有帮助,欢迎打赏本站

喜欢 ()or分享
    匿名评论
  • 评论
人参与,条评论