WDOYO模板中头部模板head.html中TDK的写法

为方便模板制作,全站统一使用一个头部模板head.html ,而头部的TDK,不同页面不一样,所以需要在头部模板head.html中进行处理.

 

{if($product['id']!='')}
<title>{$product['title']}_{$GLOBALS['S']['title']}</title>
<meta name="keywords" content="{$product['keywords']}" />
<meta name="description" content="{$product['description']}" />
<meta property="og:type" content="product"/>
<meta property="og:image" content="{$GLOBALS['S']['http']}{$product['litpic']}"/>
<meta property="og:title" content="{$product['title']}"/>
<meta property="og:description" content="{$product['description']}"/>
<meta property="og:product:brand" content="HEIMAN"/>
{else}
{if($article['id']!='')}
<title>{$article['title']}_{$GLOBALS['S']['title']}</title>
<meta name="keywords" content="{$article['keywords']}" />
<meta name="description" content="{$article['description']}" />
{else}
{if($type['tid']!='')}
<title>{$type['classname']}_{$GLOBALS['S']['title']}</title>
<meta name="keywords" content="{$type['keywords']}" />
<meta name="description" content="{$type['description']}" />
{else}
{if($type['word']!='')}
<title>{$type['word']}_{$GLOBALS['S']['title']}</title>
<meta name="keywords" content="{$type['word']}" />
<meta name="description" content="{$type['word']}" />
{else}
<title>清晨博客-{$GLOBALS['S']['title']}</title>
<meta name="keywords" content="{$GLOBALS['S']['keywords']} " />
<meta name="description" content="{$GLOBALS['S']['description']} " />
{/if}
{/if}
{/if}
{/if}

 

其中搜索页是通过

{if($type['word']!='')}

进行判断的,同时还需要修改模块的源码

比如产品频道

打开sourceproduct.php

找到function search(){函数

修改这一行

$this->type=array('title'=>'Search','keywords'=>$GLOBALS['S']['keywords'],'description'=>$GLOBALS['S']['description'],'word'=>$this->syArgs('word',1),'classname'=>'所有搜索结果',);//添加搜索词word输出

 

 
通过判断ID来进行处理,达到目的.