zblogphp在后台判断区别新建文章和新建单页页面
当我们要给zblog后台“新建文章”添加功能,又不想把该功能加到了“新建页面”里,这个时候需要进行判断:
function D_Yoga_article_edit() { //判断,$article->Type=="0"时为“新建文章”,$article->Type=="1"时为“新建页面” if ($article->Type=="0") { echo "<script type=\"text/javascript\" src=\"{$zbp->host}zb_users/theme/qiyeseo/style/js/lib.upload.js\"></script>"; echo '<label for="edtTitle" class="editinputname">封面图片</label>(封面图片包括产品封面图片和轮播图)<p class="uploadimg"> <input name="meta_pic" id="edtTitle" type="text" class="uplod_img" style="width:60%;" value="'.htmlspecialchars($article->Metas->pic).'" /> <strong style="color: #ffffff; font-size: 14px;padding: 6px 18px 6px 18px; background: #3a6ea5;cursor: pointer;">浏览文件</strong> </p>'; echo '<p><label class="editinputname">推荐属性</label> '; echo '<input type="hidden" name="meta_wtlb" value=""/> <input type="checkbox" name="meta_wtlb" value="'.htmlspecialchars('wtlb').'"'; if ($article->Metas->wtlb == 'wtlb') { echo 'checked="checked"'; } echo '/><span title="选择该项,在首页轮播图版块显示,图片将显示缩略图或文章中的第一张图片">轮播图</span> '; echo '</p>'; } }
当我们需要在两个地方都增加同样的功能是,不判断即可。