您当前的位置:首页 > 建站资讯 > 开发小技巧总结
建站资讯

开发小技巧总结

来源:我爱模版网 作者:往日 时间:2026-07-05
浏览:27 收藏 点赞(0)
简介:1、不想每个页面都使用独立的header,又需要不同页面header里面的内容不一样,该怎么办? {inc:header.htm} 在inc-header.htm文件夹当中编写代码判断: {php}$control = isset($_GET['control']) ? strtolower($_GET['control']) : '';$action = isset($_GET['action']) ? st

1、不想每个页面都使用独立的header,又需要不同页面header里面的内容不一样,该怎么办?

{inc:header.htm}

在inc-header.htm文件夹当中编写代码判断:

<!doctype html>
<html lang="zh-Hans">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="ie=edge" />
	<meta name="generator" content="LECMS" />
	<meta name="renderer" content="webkit">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    {php}$control = isset($_GET['control']) ? strtolower($_GET['control']) : '';$action = isset($_GET['action']) ? strtolower($_GET['action']) : '';{/php}
	{if:$control=='index' && $action == 'index'}
	我是首页
	{elseif:$control=='cate' && $action == 'index'}
	我是分类页
	{elseif:$control=='show' && $action == 'index'}
	我是内容页
	{elseif:$control=='tag' && $action == 'index'}
	我是标签页
	{elseif:$control=='search' && $action == 'index'}
	我是搜索页
	{elseif:$control=='comment' && $action == 'index'}
	我是内容评论页
	{elseif:$control=='tag' && $action == 'top'}
	我是热门标签页
	{else}
	其他页面
	{/if}
</head>

2、分类页模板获取当前分类信息(分类名、分类URL),同样也适用于标签页。

分类名/标签名:{$cfg_var[name]}
分类URL/标签URL:{$cfg_var[url]}
其他信息你可以先打印查看哦:{php}print_r($cfg_var);{/php}

3、内容页,允许评论才显示评论表单,不允许则无评论表单!

{if:$cfg[open_comment] && empty($gdata[iscomment])}
评论表单HTML
{/if}

$cfg[open_comment]:表示开启全站评论功能!
empty($gdata[iscomment]):表示当前内容不禁止评论,就是允许评论。
标签:小技巧
在线
客服