Home  >  Article  >  Backend Development  >  phpcms v9 template production tutorial (2)

phpcms v9 template production tutorial (2)

黄舟
黄舟Original
2016-12-30 10:45:251444browse

Today I will start the second lesson on v9 template production

1. First modify the home page template index.html

Before modifying, I will introduce to you the working mode of v9, v9 and its The predecessor of phpcms 2008 is the same as "Tag call head + homepage part + tag call bottom"

So follow the order from the beginning

The first step is to open heard.html

Now we start to analyze the structure of header.html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

上面是W3C网页标准

<head>

<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />{CHARSET}" =字符集 (gbk或者utf-8)

<meta http-equiv="X-UA-Compatible" content="IE=7" />

<title>{if isset($SEO[&#39;title&#39;]) && !empty($SEO[&#39;title&#39;])}{$SEO[&#39;title&#39;]}{/if}{$SEO[&#39;site_title&#39;]}</title>

判断语句 翻译:如果设置了标题并且标题不为空,则显示标题,否则显示网站名称

<meta name="keywords" content="{$SEO[&#39;keyword&#39;]}">

<meta name="description" content="{$SEO[&#39;description&#39;]}">

<link href="{CSS_PATH}reset.css" rel="stylesheet" type="text/css" />

<link href="{CSS_PATH}default_blue.css" rel="stylesheet" type="text/css" />

上面2行是外部css的调用{CSS_PATH}

<script type="text/javascript" src="{JS_PATH}jquery.min.js"></script>

<script type="text/javascript" src="{JS_PATH}jquery.sGallery.js"></script>

<script type="text/javascript" src="{JS_PATH}search_common.js"></script>

上面3行是网页的js调用

</head>

<body>

<div class="body-top">

<div class="content">

{pc:content action="position" posid="9" order="id" num="10" cache="3600"}

<div id="announ">

<ul>

{loop $data $k $v}

<li><a href="{$v[url]}">{$v[title]}</a></li>

{/loop}

</ul>

</div>

{/pc}

<script type="text/javascript">

$(function(){

startmarquee(&#39;announ&#39;,22,1,500,3000);

})

</script>

<div class="login lh24 blue"><a href="{APP_PATH}index.php?m=content&c=rss&siteid={get_siteid()}" 
class="rss ib">rss</a><span class="rt"><script type="text/javascript">document.write
(&#39;<iframe src="{APP_PATH}index.php?m=member&c=index&a=mini&forward=&#39;+encodeURIComponent(location.href)+&#39;&siteid={get_siteid()}"
allowTransparency="true" width="300" height="24" frameborder="0" scrolling="no"></iframe>&#39;)</script></span></div>

</div>

</div>

<div class="header">

<div class="logo"><a href="/"><img src="{IMG_PATH}v9/logo.jpg" /></a></div>

下面是搜索部分

<div class="search">

<div class="tab" id="search">

{php $j=0}

{php $search_model = getcache(&#39;search_model_&#39;.$siteid, &#39;search&#39;);}

{loop $search_model $k=>$v}

{php $j++;}

<a href="javascript:;" style="outline:medium none;" hidefocus="true" {if $j==1 && $typeid=$v[&#39;typeid&#39;]} 
class="on" {/if}>{$v[&#39;name&#39;]}</a>{if $j != count($search_model)}<span> | </span>{/if}

{/loop}

{php unset($j);}

</div> <div class="bd">

<form action="{APP_PATH}index.php" method="get" target="_blank">

<input type="hidden" name="m" value="search"/>

<input type="hidden" name="c" value="index"/>

<input type="hidden" name="a" value="init"/>

<input type="hidden" name="typeid" value="{$typeid}" id="typeid"/>

<input type="hidden" name="siteid" value="{$siteid}" id="siteid"/>

<input type="text" class="text" name="q" id="q"/><input type="submit" value="搜 索" class="button" />

</form>

</div>

</div>

搜索部分结束

<div class="banner"><script language="javascript" src="{APP_PATH}index.php?m=poster&c=index&a=show_poster&id=1"></script></div>

<div class="bk3"></div>

<div class="nav-bar">

<map>

{pc:content action="category" catid="0" num="25" siteid="$siteid" order="listorder ASC"}

<ul class="nav-site">

<li><a href="{siteurl($siteid)}"><span>首页</span></a></li>

{loop $data $r}

<li class="line">|</li>

<li><a href="{$r[url]}"><span>{$r[catname]}</span></a></li>

{/loop}

</ul>

{/pc}

</map>

</div>

{if $top_parentid}

<div class="subnav">

{pc:content action="category" catid="$top_parentid" num="15" siteid="$siteid" order="listorder ASC"}

{loop $data $r}

<a href="{$r[url]}">{$r[catname]}</a><span> | </span>

{/loop}

{/pc}

{if $modelid}<a href="{APP_PATH}index.php?m=content&c=search&catid={$catid}">搜索</a>{/if}

</div>

{/if}

</div>

It is recommended to download an opera browser. Its function of checking page elements is awesome!

The next section will continue with the main part

The above is the content of the phpcms v9 template production tutorial (2). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn