今天開始講v9模板製作的第二節課
1、先修改首頁模板index.html
修改前向大家介紹下v9的工作模式,v9和他的前身phpcms 2008是一樣的都是「標籤呼叫頭部+首頁部分+ 標籤呼叫底部”
所以按照從頭開始的順序
第一步打開heard.html
現在我們開始分析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['title']) && !empty($SEO['title'])}{$SEO['title']}{/if}{$SEO['site_title']}</title> 判断语句 翻译:如果设置了标题并且标题不为空,则显示标题,否则显示网站名称 <meta name="keywords" content="{$SEO['keyword']}"> <meta name="description" content="{$SEO['description']}"> <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('announ',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 ('<iframe src="{APP_PATH}index.php?m=member&c=index&a=mini&forward='+encodeURIComponent(location.href)+'&siteid={get_siteid()}" allowTransparency="true" width="300" height="24" frameborder="0" scrolling="no"></iframe>')</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('search_model_'.$siteid, 'search');} {loop $search_model $k=>$v} {php $j++;} <a href="javascript:;" style="outline:medium none;" hidefocus="true" {if $j==1 && $typeid=$v['typeid']} class="on" {/if}>{$v['name']}</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>
現在我們開始分析header.html的構造:
rrreee
下一節繼續講主體部分
以上就是phpcms v9模板製作教學(二)的內容,更多相關內容請關注PHP中文網(www.php.cn)!