织梦dedecms 茬會员中心或后台 隐藏特定字段,部分或个别自定义字段的方法
织梦dedecms在会员中心或后台隐藏特定字段,部分或个别自定义字段的方法
比如在后台内容模型管理中,普通文章模型,
更多精彩就在: 51免费论文网|www.jxszl.com
新增加了n个字段.但在发表文档时,不希望直接显示个别字段,比如商品价格从高到低排序字段myorder字段.这个字段虽然在后台有定义.但他的值是没有必要在后台固定的,因为在前台点击按价格排序时,程序会执行orderbypriceasc的sql语句.与这个字段本身的值无关.
所以,前台就没有必要显示这个字段.会员中心如果想过滤掉这个字段,需要修改memberincinc_archives_functions.php中的PrintAutoFieldsAdd及PrintAutoFieldsEdit函数.把这句
foreach($dtp->CTagsas$tid=>$ctag)
{
if($loadtype!=autofield
||($loadtype==autofield&&$ctag->GetAtt(autofield)==I.))
{
$dede_addonfields.=($dede_addonfields==""?$ctag->GetName().",".$ctag->GetAtt(type):";".$ctag->GetName().",".$ctag->GetAtt(type));
echoGetFormItemA($ctag);
}
}
对比修改为下面这句即可.
foreach($dtp->CTagsas$tid=>$ctag){
if($ctag->GetName()==myorder||$ctag->GetName()==mystate){
unset($ctag);//如果字段名为myorder或mystate,则删除字段所在的数组.并跳过下面的执行.
}else{
//否则,继续向下执行.
if($loadtype!=autofield||$ctag->GetAtt(autofield)==I.)
{
$dede_addonfields.=($dede_addonfields==""?$ctag->GetName().",".$ctag->GetAtt(type):";".$ctag->GetName().",".$ctag->GetAtt(type));
$addonfieldsname.=",".$ctag->GetName();
if($isprint)echoGetFormItemA($ctag);
}
}
}
网站后台修改文件在dedeincinc_archives_functions.php这里面.修改方法I.致.
原文链接:http://www.jxszl.com/biancheng/dedecms/74995.html
热门阅读