昨天接一個(gè)zblogphp淘客店鋪導(dǎo)航站定制,其中用到了編輯文章頁面添加信用數(shù)字,前臺(tái)顯示信用圖片,今天來記錄分享出來:
以上就是信用圖片,淘寶的信用圖都對(duì)應(yīng)相應(yīng)的信用數(shù)字,如:
前臺(tái)要轉(zhuǎn)換為:
后臺(tái)編輯為:
其中用到了信用數(shù)字轉(zhuǎn)換為圖片,我是這么做的:
1、先為文章編輯中加入信用字段:
include.php掛載:
Add_Filter_Plugin('Filter_Plugin_Edit_Response5','ydtao_article_tao');
2、加入:
function ydtao_article_tao(){ global $zbp,$article; echo '<p>掌柜: <input type="text" style="width:30%;" name="meta_zhanggui" value="'.$article->Metas->zhanggui.'"/></p>'; echo '<p>信用: <input type="text" style="width:30%;" name="meta_xinyong" value="'.$article->Metas->xinyong.'"/></p>'; echo '<p>行業(yè): <input type="text" style="width:30%;" name="meta_hangye" value="'.$article->Metas->hangye.'"/></p>'; echo '<p>網(wǎng)址: <input type="text" style="width:80%;" name="meta_url" value="'.$article->Metas->url.'"/></p>'; }
3、為前臺(tái)模板中加入<img src='下方代碼單獨(dú)文件'>
4、建一個(gè)單獨(dú)的模板文件,放入下方這些判斷,用數(shù)值判斷范圍,顯示對(duì)應(yīng)圖片:
<?php echo'404';die();?>{if $article.Metas.xinyong>4&&$article.Metas.xinyong<10 } {$host}zb_users/theme/{$theme}/style/img/tao/s_red_1.gif {elseif $article.Metas.xinyong>11&&$article.Metas.xinyong<40 } {$host}zb_users/theme/{$theme}/style/img/tao/s_red_2.gif {elseif $article.Metas.xinyong>41&&$article.Metas.xinyong<90 } {$host}zb_users/theme/{$theme}/style/img/tao/s_red_3.gif {elseif $article.Metas.xinyong>91&&$article.Metas.xinyong<150 } {$host}zb_users/theme/{$theme}/style/img/tao/s_red_4.gif {elseif $article.Metas.xinyong>151&&$article.Metas.xinyong<250 } {$host}zb_users/theme/{$theme}/style/img/tao/s_red_5.gif {elseif $article.Metas.xinyong>251&&$article.Metas.xinyong<500 } {$host}zb_users/theme/{$theme}/style/img/tao/s_blue_1.gif {elseif $article.Metas.xinyong>501&&$article.Metas.xinyong<1000 } {$host}zb_users/theme/{$theme}/style/img/tao/s_blue_2.gif {elseif $article.Metas.xinyong>1001&&$article.Metas.xinyong<2000 } {$host}zb_users/theme/{$theme}/style/img/tao/s_blue_3.gif {elseif $article.Metas.xinyong>2001&&$article.Metas.xinyong<5000 } {$host}zb_users/theme/{$theme}/style/img/tao/s_blue_4.gif {elseif $article.Metas.xinyong>5001&&$article.Metas.xinyong<10000 } {$host}zb_users/theme/{$theme}/style/img/tao/s_blue_5.gif {if $article.Metas.xinyong>10001&&$article.Metas.xinyong<20000 } {$host}zb_users/theme/{$theme}/style/img/tao/s_cap_1.gif {elseif $article.Metas.xinyong>20001&&$article.Metas.xinyong<50000} {$host}zb_users/theme/{$theme}/style/img/tao/s_cap_2.gif {elseif $article.Metas.xinyong>50001&&$article.Metas.xinyong<100000} {$host}zb_users/theme/{$theme}/style/img/tao/s_cap_3.gif {elseif $article.Metas.xinyong>100001&&$article.Metas.xinyong<200000} {$host}zb_users/theme/{$theme}/style/img/tao/s_cap_4.gif {elseif $article.Metas.xinyong>200001&&$article.Metas.xinyong<500000} {$host}zb_users/theme/{$theme}/style/img/tao/s_cap_5.gif {elseif $article.Metas.xinyong>500001&&$article.Metas.xinyong<1000000} {$host}zb_users/theme/{$theme}/style/img/tao/s_crown_1.gif {elseif $article.Metas.xinyong>1000001&&$article.Metas.xinyong<2000000} {$host}zb_users/theme/{$theme}/style/img/tao/s_crown_2.gif {elseif $article.Metas.xinyong>2000001&&$article.Metas.xinyong<5000000} {$host}zb_users/theme/{$theme}/style/img/tao/s_crown_3.gif {elseif $article.Metas.xinyong>5000001&&$article.Metas.xinyong<10000000} {$host}zb_users/theme/{$theme}/style/img/tao/s_crown_4.gif {elseif $article.Metas.xinyong>10000001} {$host}zb_users/theme/{$theme}/style/img/tao/s_crown_5.gif {else}{/if}