Focus on cloud service provider activities
Notes on website operation and maintenance

Common Typecho Making Theme Call Script and Skills

If we just imitate or modify the CMS theme, it is actually quite simple. As long as we know simple HTML CSS knowledge and collate the common invocation scripts of the CMS, we can basically modify and create the theme ourselves. After seeing a good WORDPRESS theme, because its interface is too complex and takes up too much resources, there is no special need to use TYPECHO or ZBP (ZBLOG PHP) to create websites.

In this article, Lao Zuo is dedicated to sorting out the collection of commonly used scripts in the production of commonly used TYPECHO themes, so that no matter what theme you are working on, the call file can be copied directly, as long as you do a good job in the front end, for CMS If the function itself is not used for in-depth research, there is no need to recite it backwards, and the old left is not easy to use, so it will be directly accumulated in the blog and copied for use later.

First, breadcrumb navigation

 <div class="crumbs_patch">Your location: <a href="<php $this ->options ->siteUrl();>">Website Home</a>&raquo; </li> <php if ($this->is('index')): ><! --When the page is the first page --> Latest Post <php elseif ($this->is('post')): ><! --When the page is a single page of an article --> <php $this->category();  > &raquo;  <php $this->title() > <php else: ><! --When the page is another page --> <php $this->archiveTitle(' &raquo; ','','');  > <php endif;  > </div>

Add the above script at the appropriate location of INDEX.PHP, PAGE. PHP and POST. PHP pages to realize the breadcrumb function. Of course, you need to set a definition style for crumbs_patch.

Second, call related content

 <php$this->related(5)->to($relatedPosts); > <phpif($relatedPosts->have()):> <phpwhile($relatedPosts->next()):> <li> <a href="<php$relatedPosts->permalink();>" title="<php$relatedPosts->title();>"><php$relatedPosts->title(); ></a> <small><strong><php$relatedPosts->author(); ></strong> post in<php$this->date('Y-m-d H:i:s'); ></small> </li> <phpendwhile; > <phpelse:> <li>No Related Post</li> <phpendif;>

Related article calls, especially TYPECHO, basically do not need to be implemented with plug-ins.

Third, tag cloud call

 <php$this->widget('Widget_Metas_Tag_Cloud','ignoreZeroCount=1&limit=20')->to($tags); > <phpwhile($tags->next()):> <a href="<php$tags->permalink();>"margin: 0px;  padding: 0px;  border: 0px;  outline: 0px;  vertical-align: baseline;  background-color: transparent;  font-family: '[object]', 'Lucida Console', 'Courier New', monospace;  color: rgb(76, 131, 23);  "><php$tags->split(5, 10,20,30); >"><php$tags->name();></a> <phpendwhile;>

Fourth, call the latest article

 <php$this->widget('Widget_Contents_Post_Recent')->to($post); > <phpwhile($post->next()):> <a href="<php$post->permalink();>" title="<php$post->title();>"><php$post->title(25,'...'); ></a> <phpendwhile;>

Fifth, date archiving

 <php$this->widget('Widget_Contents_Post_Date','type=month&format=F Y') ->parse('<li><a href="{permalink}">{date}</a> ({count})</li>');>

Sixth, Previous, Next

 <php $this ->thePrev ('previous:% s','no previous');  > <php $this ->theNext ('next:% s','no next ');  >

perhaps

 <php $this->thePrev('&laquo; %s', '');  > <php $this->theNext('%s &raquo;', '');  >

VII. Common Call Script

 /*Head commonly used <php $this->keywords('_'); >//Keywords <php $this->options->title(); >//Site Name <php $this->options->description(); >//Site Description <php $this->archiveTitle(); >//Title <php $this->options->themeUrl('ie.css'); >//Template Path <php $this->options->siteUrl(); >//Home URL <php $this->options->feedUrl();  > <php $this->options->commentsFeedUrl();  > <php $this->pageNav(); >//Pagination <php $this->options->generator(); >//Version No /*Common on article page <php $this->title(); >//Title <php $this->category(','); >//Classification <php $this->tags(', ', true, ''); >//Label <php $this ->date ('F jS, Y ')>//time <php $this->content(); >//Content <php $this->thePrev('&laquo; %s', ''); >//Previous <php $this->theNext('%s &raquo;', ''); >//Next

This is all for the time being. After Laozuo has made more themes, he will call and share the common scripts for the problems he has encountered.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( two )
Do not reprint without permission: Lao Zuo's Notes » Common Typecho Making Theme Call Script and Skills