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 doing, the call file can be copied directly, as long as you do a good job in the front end. If you are not going to do in-depth research on the functions of the CMS itself, there is no need to recite them backwards, and Lao Zuo is not good at using them, It is directly accumulated in the blog and then copied for use.

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>

In INDEX PHP、PAGE. PHP and POST Add the above script to the appropriate location of the PHP page to realize the breadcrumb function. Of course, you need to_ The patch setting defines the style.

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('_'); >// key word <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(); >// paging <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.

Like( two )
Do not reprint without permission: Lao Zuo's Notes » Common Typecho Making Theme Call Script and Skills


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge