catalog
Getting Started with Template Making
index.php
Template Information
/** *This is a set of default skins for the typecho system. You can use the<a href=“ http://typecho.org ">The official website of typecho</a>gets more information about this skin * * @package Typecho Default Theme * @author typecho * @version 1.0.0 * @link http://typecho.org */
Show Article
<? php while ( $this -> next ( ) ) : ?> <div class="post"> <h2 class="entry_title"><a href=" <? php $this -> permalink ( ) ?> "> <? php $this -> title ( ) ?> </a></h2> <div class="entry_data"> Published by <a href=" <? php $this -> author -> permalink ( ) ; ?> "> <? php $this -> author ( ) ; ?> </a> on <? php $this -> date ( 'F j, Y' ) ; ?> in <? php $this -> category ( ',' ) ; ?> . <? php $this -> commentsNum ( '%d Comments' ) ; ?> . </div> <div class="entry_text"> <? php $this -> content ( 'Continue Reading...' ) ; ?> </div> </div> <? php endwhile ; ?>
| |
| |
| |
| |
| |
| |
| |
| |
Article pagination
<? php $this -> pageNav ( ) ; ?>
header.php
code
<meta http-equiv="content-type" content="text/html; charset= <? php $this -> options -> charset ( ) ; ?> " />
Page Title
<title> <? php $this -> options -> title ( ) ; ?> <? php $this -> archiveTitle ( ) ; ?> </title>
Import Styles
<link rel="stylesheet" type="text/css" media="all" href=" <? php $this -> options -> themeUrl ( 'style.css' ) ; ?> " />
Other HTML header information
<? php $this -> header ( ) ; ?>
Page Navigation
<ul class="clearfix" id="nav_menu"> <li><a href=" <? php $this -> options -> siteUrl ( ) ; ?> ">Home</a></li> <? php $this -> widget ( 'Widget_Contents_Page_List' ) -> parse ( '<li><a href="{permalink}">{title}</a></li>' ) ; ?> </ul>
Site Name
<h1><a href=" <? php $this -> options -> siteUrl ( ) ; ?> "> <? php $this -> options -> title ( ) ?> </a></h1> <span> <? php $this -> options -> description ( ) ?> </span>
| |
| |
| |
On site search
< form method = "post" action = "" > < div >< input type = "text" name = "s" class = "text" size = "32" / > < input type = "submit" class = "submit" value = "Search" / >< / div > < / form >
sidebar.php
Latest article list
<ul> <? php $this -> widget ( 'Widget_Contents_Post_Recent' ) -> parse ( '<li><a href="{permalink}">{title}</a></li>' ) ; ?> </ul>
< ul > < li >< a href = " http://example.com/2008/12/31/sample-post-one " > Title of article 1 < / a >< / li > < li >< a href = " http://example.com/2008/12/31/sample-post-two " > Title of article 2 < / a >< / li > <!-- Omit n duplicates --> < li >< a href = " http://example.com/2008/12/31/sample-post-ten " > Title of article 10 < / a >< / li > < / ul >
Latest reply list
<ul> <? php $this -> widget ( 'Widget_Comments_Recent' ) -> to ( $comments ) ; ?> <? php while ( $comments -> next ( ) ) : ?> <li> <? php $comments -> author ( false ) ; ?> : <a href=" <? php $comments -> permalink ( ) ; ?> "> <? php $comments -> excerpt ( ten , '[...]' ) ; ?> </a></li> <? php endwhile ; ?> </ul>
< ul > < li > Respondent's name: < a href = " http://example.com/2008/12/31/sample-post#comments -12" > Reply content [...] < / a >< / li > < li > Respondent's name: < a href = " http://example.com/2008/12/31/sample-post#comments -11" > Reply content [...] < / a >< / li > <!-- Omit n duplicates --> < / ul >
Article classification list
<ul> <? php $this -> widget ( 'Widget_Metas_Category_List' ) -> parse ( '<li><a href="{permalink}">{name}</a> ({count})</li>' ) ; ?> </ul>
< ul > < li >< a href = " http://example.com/category/uncategories " > Uncategories < / a > (10) < / li > < li >< a href = " http://example.com/category/category-1 " > Category-1 < / a > (2) < / li > < / ul >
Archive by month
<ul> <? php $this -> widget ( 'Widget_Contents_Post_Date' , 'type=month&format=F Y' ) -> parse ( '<li><a href="{permalink}">{date}</a></li>' ) ; ?> </ul>
< ul > < li >< a href = " http://example.com/2008/11 " > November 2008 < / a >< / li > < li >< a href = " http://example.com/2008/10 " > October 2008 < / a >< / li > < / ul >
Other connections
<ul> <? php if ( $this -> user -> hasLogin ( ) ) : ?> <li class="last"><a href=" <? php $this -> options -> index ( 'Logout.do' ) ; ?> ">Logout ( <? php $this -> user -> screenName ( ) ; ?> )</a></li> <? php else : ?> <li class="last"><a href=" <? php $this -> options -> adminUrl ( 'login.php' ) ; ?> ">Login</a></li> <? php endif ; ?> </ul>
footer.php
RSS Address
<a href=" <? php $this -> options -> feedUrl ( ) ; ?> ">Entries (RSS)</a><! -- RSS address connection of the article --> <a href=" <? php $this -> options -> commentsFeedUrl ( ) ; ?> ">Comments (RSS)</a>.<! -- RSS address connection of comments -->
< a href = " http://typecho.org " > Typecho < / a >
post.php
Tag tag
Tags: <? php $this -> tags ( ',' , true , 'none' ) ; ?>
Call comment page
<? php include ( 'comments.php' ) ; ?>
comments.php
Comment List
<h4> <? php $this -> commentsNum ( 'No Response' , 'One Response to"' . $this -> title . '"' , '%d Responses to "' . $this -> title . '"' ) ; ?> </h4> <ol id="comment_list"> <? php $this -> comments ( ) -> to ( $comments ) ; ?> <? php while ( $comments -> next ( ) ) : ?> <li id=" <? php $comments -> theId ( ) ; ?> "> <div class="comment_data"> <? php echo $comments -> sequence ( ) ; ?> . <strong> <? php $comments -> author ( ) ; ?> </strong> on <? php $comments -> date ( 'F jS, Y' ) ; ?> at <? php $comments -> date ( 'h:i a' ) ; ?> </div> <div class="comment_body"> <? php $comments -> content ( ) ; ?> </div> </li> <? php endwhile ; ?> </ol>
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comment Input Form
<!-- Judge whether the setting allows comments on the current article --> <? php if ( $this -> allow ( 'comment' ) ) : ?> <h4 id="response">Leave a Reply</h4> <!-- Enter the beginning of the form --> <form method="post" action=" <? php $this -> commentUrl ( ) ?> " id="comment_form"> <!-- If the current user has logged in --> <? php if ( $this -> user -> hasLogin ( ) ) : ?> <!-- Display the user name and logout connection of the current login user --> <p>Logged in as <a href=" <? php $this -> options -> adminUrl ( ) ; ?> "> <? php $this -> user -> screenName ( ) ; ?> </a>. <a href=" <? php $this -> options -> index ( 'Logout.do' ) ; ?> " title="Logout">Logout »</a></p> <!-- If the current user is not logged in --> <? php else : ?> <!-- You are required to enter your name, email address and web address --> <p><input type="text" name="author" class="text" size="35" value=" <? php $this -> remember ( 'author' ) ; ?> " /><label>Name (Required)</label></p> <p><input type="text" name="mail" class="text" size="35" value=" <? php $this -> remember ( 'mail' ) ; ?> " /><label>E-mail (Required *will not be published)</label></p> <p><input type="text" name="url" class="text" size="35" value=" <? php $this -> remember ( 'url' ) ; ?> " /><label>Website</label></p> <? php endif ; ?> <!-- Enter the content to reply --> <p><textarea rows="10" cols="50" name="text"> <? php $this -> remember ( 'text' ) ; ?> </textarea></p> <p><input type="submit" value="Submit Comment" class="submit" /></p> </form> <? php endif ; ?>
Other documents
| |
---|---|
| |
Conclusion