隨著ecshop越來越多,使用ecshop做商城的不計其數,據說這樣不利于ecshop SEO,所有的ecshop的模板都差不多,如果內容相同的話,那么對搜索引擎來說,是特別不友好的,為了減少重復性內容,而且ecshop的標題也存在特別大的問題。比如標題。他就是通過標題+文章分類+商城名稱組成的。為了讓ecshop文章標題更加靈活。我們可以采用ecshop文章頁面自定義標題。
1:首先給ecshop的文章表ecs_article增加個字段。
alter table ecs_article add column seo_title varchar(128)
2: admin/templates/article_info.htm
<tr>
<td class="narrow-label">{$lang.title}</td>
<td><input type="text" name="seo_title " size ="40" maxlength="60" value="{$article.seo_title |escape}" />{$lang.require_field}</td>
</tr>
3:admin/article.php
$sql = "INSERT INTO ".$ecs->table('article')."(title, cat_id, article_type, is_open, author, ".
"author_email, keywords, content, add_time, file_url, open_type, link, description,seo_title) ".
"VALUES ('$_POST[title]', '$_POST[article_cat]', '$_POST[article_type]', '$_POST[is_open]', ".
"'$_POST[author]', '$_POST[author_email]', '$_POST[keywords]', '$_POST[FCKeditor1]', ".
"'$add_time', '$file_url', '$open_type', '$_POST[link_url]', '$_POST[description]','$_POST[seo_title]')";
4:admin/article.php
$exc->edit("title='$_POST[title]', cat_id='$_POST[article_cat]', article_type='$_POST[article_type]', is_open='$_POST[is_open]', author='$_POST[author]', author_email='$_POST[author_email]', keywords ='$_POST[keywords]', file_url ='$file_url', open_type='$open_type', content='$_POST[FCKeditor1]', link='$_POST[link_url]', description = '$_POST[description]',seo_title='$_POST[seo_title]'", $_POST['id'])
5:article.dwt里面調用
{$article.seo_title}
以上就完成了ecshop文章頁面自定義標題
新聞熱點
疑難解答