本文引见一下Zblog之txcms2模板于SiteNav模板兼并的教程,现在将SiteNav的功用兼并到天兴工作室的模板中。
1、首先在当前模板的include.php建立一下插件
//标题字体 2017-09-05 16:22:15function txcms2_Font(){global $zbp,$article;if(!$article->Metas->djump){$article->Metas->djump= '';}if(!$article->Metas->fweight){$article->Metas->fweight= '';}if(!$article->Metas->fcolor){$article->Metas->fcolor= '';}echo '<div style="margin-left:16%;border-top:1px #ddd dashed;margin-top:-3px;padding-bottom:11px;"></div><label for="meta_djump" class="editinputname" title="开启后只能在文章页点击外链">网址内置</label> <input name="meta_djump" style="display:none;" type="text" value="'.$article->Metas->djump.'" class="checkbox">'; echo '<div id="alias" class="editmod"><label for="meta_fweight" class="editinputname">标题加粗</label> <input name="meta_fweight" style="display:none;" type="text" value="'.$article->Metas->fweight.'" class="checkbox"></div>'; echo '<div id="alias" class="editmod"><label for="meta_fcolor" class="editinputname">色彩</label> <input type="text" name="meta_fcolor" value="'.htmlspecialchars($article->Metas->fcolor).'"/><div style="color:#F8BC8B;font-size:12px;padding-top:6px;">↙↗txcms2主题专有设置项</div></div>';echo "<link href=\"{$zbp->host}zb_users/theme/txcms2/source/colpick.css\" rel=\"stylesheet\" type=\"text/css\" /><style>.colpick{left:auto !important;;right:20px !important;}</style><script src=\"{$zbp->host}zb_users/theme/txcms2/source/colpick.js\"></script><script>$(function(){$('input[name=meta_fcolor]').colpick({layout:'hex',submit:0,onChange:function(hsb,hex,rgb,el,bySetColor) {$(el).css('color','#'+hex);if(!bySetColor) $(el).val('#'+hex);}}).keyup(function(){$(this).colpickSetColor(this.value);});});</script>";}//网站网址、首页图片、单页图片 Urlfunction txcms2_Url(){ global $zbp,$article; if(!$article->Metas->alink){$article->Metas->alink= '';}if(!$article->Metas->imgindex){$article->Metas->imgindex= '';}if(!$article->Metas->imgpage){$article->Metas->imgpage= '';}echo '<div id="alias" class="editmod2"><label for="meta_alink" class="editinputname">网址</label> <input type="text" name="meta_alink" value="'.htmlspecialchars($article->Metas->alink).'" placeholder="请填写相符范例的外链网址,如 http://www.yiwuku.com" style="width:50%"></div>';echo '<div id="alias" class="editmod2"><label for="meta_imgindex" class="editinputname">首页图片</label> <input type="text" name="meta_imgindex" value="'.htmlspecialchars($article->Metas->imgindex).'" placeholder="网站首页图片,发起宽度800px" style="width:50%"><strong class="upbtn" title="基于UEditor完成上传" style="color:#fff;padding:3px 15px;margin:0 0.5em;background:#3a6ea5;border:1px solid #3399cc;cursor:pointer;">阅读</strong><span style="color:#F8BC8B;font-size:12px">imgindex</span></div>';echo '<div id="alias" class="editmod2"><label for="meta_imgpage" class="editinputname">单页图片</label> <input type="text" name="meta_imgpage" value="'.htmlspecialchars($article->Metas->imgpage).'" placeholder="网站单页图片,发起宽度800px" style="width:50%"><strong class="upbtn" title="基于UEditor完成上传" style="color:#fff;padding:3px 15px;margin:0 0.5em;background:#3a6ea5;border:1px solid #3399cc;cursor:pointer;">阅读</strong><span style="color:#F8BC8B;font-size:12px">imgpage</span></div>';if ($zbp->CheckPlugin('UEditor')) { echo '<script type="text/javascript" src="'.$zbp->host.'zb_users/theme/txcms2/plugin/lib.upload.js"></script>';}}2、修正Zblog当前模板的template文件夹下post-multi.php(分类列表)模板,我将有图则显现{elseif $zbp->Config('txcms2')->lieb=='3'}增添了一些推断:
a.右边图片增添内容图显现或首页截图显现或单页截图显现
{elseif $zbp->Config('txcms2')->lieb=='3'}{if isset($matchContent[1][0])} <a href="{$article.Url}" title="{$article.Title}" target="_blank" class="list-tu {if $zbp->CheckPlugin('IMAGE')}{else}noslt{/if}"><img src="{txcms2_FirstIMG($article,160,135)}" alt="{$article.Title}" /></a> {elseif $article->Metas->imgindex!=""} <a href="{$article.Url}" title="{$article.Title}" target="_blank" class="list-tu {if $zbp->CheckPlugin('IMAGE')}{else}noslt{/if}"><img src="{$article.Metas.imgindex}" alt="{$article.Title}的首页截图"/></a> {elseif $article->Metas->imgpage!=""} <a href="{$article.Url}" title="{$article.Title}" target="_blank" class="list-tu {if $zbp->CheckPlugin('IMAGE')}{else}noslt{/if}"><img src="{$article.Metas.imgpage}" alt="{$article.Title}的单页截图"/></a> {/if}{else} b.增添标题加粗、色彩的替代
<h2><a href="{$article.Url}"{if $article->Metas->fcolor!="" || $article->Metas->fweight==1} style="{if $article->Metas->fweight==1}font-weight:bold;{/if}{if $article->Metas->fcolor!=""}color:{$article->Metas->fcolor};{/if}"{/if} title="{$article.Title}">{$article.Title}</a></h2>3、修正 Zblog 当前模板的 template 文件夹下index-list.php(分类页子目录 )模板,我增添了标题是不是加粗加色的推断
{foreach GetList($zbp->Config('txcms2')->cmssl,$flid,null,null,null,null,array('has_subcate'=>true)) as $related}<li><span>{$related.Time('m-d')}</span><i class="fa fa-caret-right"></i><a href="{$related.Url}"{if $related->Metas->fcolor!="" || $related->Metas->fweight==1} style="{if $related->Metas->fweight==1}font-weight:bold;{/if}{if $related->Metas->fcolor!=""}color:{$related->Metas->fcolor};{/if}"{/if} title="{$related.Title}">{$related.Title}</a></li>{/foreach}4.修正 Zb log 当前模板的 template 文件夹下index-s.php(首页子列表页)模板,我增添里若有链接则跳转的功用,加在<i class="fa fa-caret-right"></i>背面
{if $related->Metas->alink!="" && $related->Metas->djump!=1}<a href="http://www.qro.cn/go.php?url=http://{$related->Metas->alink}"{if $related->Metas->fcolor!="" || $related->Metas->fweight==1} style="{if $related->Metas->fweight==1}font-weight:bold;{/if}{if $related->Metas->fcolor!=""}color:{$related->Metas->fcolor};{/if}"{/if} target="_blank" title="{$related.Title}">{$related.Title}</a>{else}<a href="{$related.Url}"{if $related->Metas->fcolor!="" || $related->Metas->fweight==1} style="{if $related->Metas->fweight==1}font-weight:bold;{/if}{if $related->Metas->fcolor!=""}color:{$related->Metas->fcolor};{/if}"{/if}itle="{$related.Title}">{$related.Title}</a>{/if}
评论列表