Learning typecho topic development Notes 01, typecho topic notes 01_PHP tutorial

Source: Internet
Author: User
Study typecho topic development Notes 01 and typecho topic notes 01. Learning typecho topic development Notes 01 and typecho topic notes 01 the blog was deprecated by jiasule, so I had the idea of learning typecho topic development. thank you for taking this opportunity! First, go to the topic folder to learn typecho topic development Notes 01, typecho topic notes 01

My blog has been ruined by jiasule, so I have the idea of learning typecho topic development. thank you for taking this opportunity!


First, go to the 'index. php' under the topic folder. the article page of a blog generally includes the following basic elements:

  • Author
  • Posting time
  • Article Category 1 Need ('header. php'); 13?> 14 15

    16 Next ():?> 17 class = "post" itemscope itemtype = "http://schema.org/BlogPosting"> 18 class = "post-title" itemprop = "name headline"> $ this-> permalink ()?> "> Title ()?> 19

      20
    • $ This-> author-> permalink ();?> "Rel =" author "> Author ();?>
    • 21
    • Date ('F j, y');?>
    • 22
    • Category (',');?>
    • 23
    • $ This-> permalink ()?> # Comments "> CommentsNum ('comments', '1 comments', '% d Comments');?>
    • 24
    25

    26 Content ('-read the remaining part-');?> 27

    2829 30 31 PageNav ('previous page', 'next page');?> 32

    33 34 Need ('sidebar. php');?> 35 Need ('footer. php ');?

Below is the source code of index. php:

1
 Need ('header. php'); 13?> 14 15

16 Next ():?> 17 class = "post" itemscope itemtype = "http://schema.org/BlogPosting"> 18 class = "post-title" itemprop = "name headline"> $ this-> permalink ()?> "> Title ()?> 19

    20
  • $ This-> author-> permalink ();?> "Rel =" author "> Author ();?>
  • 21
  • Date ('F j, y');?>
  • 22
  • Category (',');?>
  • 23
  • $ This-> permalink ()?> # Comments "> CommentsNum ('comments', '1 comments', '% d Comments');?>
  • 24
25

26 Content ('-read the remaining part-');?> 27

2829 30 31 PageNav ('previous page', 'next page');?> 32

33 34 Need ('sidebar. php');?> 35 Need ('footer. php');?>

2-9 rows are comments that contain various topic information. each line starts.

@ Package indicates the topic name.

@ Author indicates the author information.

@ Version indicates the current version of the topic.

@ Link: The author's website link

The include () method is used to include the PHP file to be used. for details about the usage, refer to the PHP official manual include () method.

$ This-> need () can be seen in lines 12, 34, and 35. it works the same as include () in typecho.

 
$this->need('header.php');
 need('sidebar.php'); ?>
 need('footer.php'); ?>
 

The above code calls header. php, sidebar. php, and footer. php. What are the specific functions of these three php files? it's very simple, as the name suggests!

Then the subject of the article page

 

Next ():?> Class = "post" itemscope itemtype = "http://schema.org/BlogPosting"> class = "post-title" itemprop = "name headline"> $ this-> permalink ()?> "> Title ()?>

  • $ This-> author-> permalink ();?> "Rel =" author "> Author ();?>
  • Date ('F j, y');?>
  • Category (',');?>
  • $ This-> permalink ()?> # Comments "> CommentsNum ('comments', '1 comments', '% d Comments');?>

Content ('-read the remaining part-');?>

PageNav ('previous page', 'next page');?>

What is endwhile ???? Why I have never used it again... I checked the materials and it turned out to be a syntactic sugar :)

The subject of the article is from here to the end

 next()): ?>
 

: Replaced {

; Replaced}

For details, see the alternative syntax of process control in PHP.

Then there are some methods.

 Permalink ()?> Connection of the article
 Title ()?> Article title
 Author ();?> Author
 Author-> permalink ();?> Author address
 Date ('F j, y');?> The release date of the article. for the format, refer to the PHP date format.
 Category (',');?> Document category
 CommentsNum ('% d Comments');?> Number of comments and connections
 Content ('continue Reading... ');?> Content of the article, "Continue Reading ..." Is the text hidden when the abstract is displayed.

_ E () What is this method? it's dedicated and refined.

After reading the _ e () method in wordpress, it is used for translation... Does typecho still have nuts to use (escape)

Directly print the string output to html and use _ e ().For details, see here

You can also see the itemprop attribute in the code. this is newly added to html5 and does not need to worry about its Q. Q

The last is a paging method.

 pageNav(); ?>

So far, the index. php file has been analyzed. although I have no foundation for php, it is not difficult to find out after learning it! Continue to work!

The idea of learning typecho topic development has been lost in the ghost blog. thank you for taking this opportunity! First, go to the theme folder...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.