Php blog website development example tutorial (1/8)

Source: Internet
Author: User
Tags flock php website

Php blog website development example tutorial this chapter introduces a simple text-based BLOG system, of course, we can use this blog system development, a good understanding of php website development principles, in fact, website development is easier to blog. The following describes the functional modules.

Php tutorial blog website development example tutorial
This chapter introduces a simple text-based blog system. Of course, we can use this blog system to develop and understand the principles of php website development. In fact, website development is easy to blog, the following describes the functional modules.
Post. php program that reads files and displays log Content.
Page.html displays the html document of a log article.
Css code that shows the effect on the style.css tutorial page.
Add. php program for adding blog articles.
Config/auth. php user name and password configuration file.
Index. php blog homepage program.
Edit. php: The program used to edit a blog article.
Delete. php: The program used to delete a blog article.
Archives. php: a program for archiving and displaying blog articles.
Logout. php exit the logon program.

*/
// Post. php program that reads the file and displays the log Content.
 

<? Php
If (! Isset ($ _ get ['entry '])
{
Echo 'request parameter error ';
Exit;
}

$ Post_data = array ();

$ Path = substr ($ _ get ['entry '],); // log storage directory
$ Entry = substr ($ _ get ['entry '], 7,9); // Log File Name
$ File_name = 'tents/'. $ path.'/'.w.entry.'.txt ';

If (file_exists ($ file_name ))
{
$ Fp = @ fopen ($ file_name, 'R ');
If ($ fp)
{
Flock ($ fp, lock_sh );
$ Result = fread ($ fp, filesize ($ file_name) * 100 );
}
Flock ($ fp, lock_un );
Fclose ($ fp );
}

$ Content_array = explode ('|', $ result );

$ Post_data ['subobject'] = $ content_array [0];
$ Post_data ['date'] = date ('Y-m-d h: I: s', $ content_array [1]);
$ Post_data ['content'] = $ content_array [2];
// Print_r ($ post_data );
?>

<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html>
<Head>
<Title> text-based simple blog </title>
<Link rel = "stylesheet" type = "text/css" href = "style.css"/>
</Head>
<Body>

<Div id = "container">
<Div id = "header">
<H1> my blog </Div>
<Div id = "title">
---- I have dream ....
</Div>
<Div id = "left">
<Div id = "blog_entry">
<Div id = "blog_title"> <? Echo $ post_data ['subobject'];?> </Div>
<Div id = "blog_body">
<Div id = "blog_date"> <? Echo $ post_data ['date'];?> </Div>
<? Echo $ post_data ['content'];?>
</Div> <! -- Blog_body -->
</Div> <! -- Blog_entry -->
</Div>
 
<Div id = "right">
<Div id = "sidebar">
<Div id = "menu_title"> about me </div>
<Div id = "menu_body"> www. bKjia. c0m </div>
</Div>
</Div>
 
<Div id = "footer">
Copyright 2007
</Div>
</Div>

<Body>
</Html>

// Page.html displays the html document of the log article.
 

<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html>
<Head>
<Title> blog </title>
<Link rel = "stylesheet" type = "text/css" href = "style.css"/>
</Head>
<Body>

<Div id = "container">
<Div id = "header">
<H1> my blog </Div>
<Div id = "title">
---- I have a dream ....
</Div>
<Div id = "left">
<Div id = "blog_entry">
<Div id = "blog_title"> log article title </div>
<Div id = "blog_body">
<Div id = "blog_date"> 2007-12-01 </div>
Log article content
</Div>
</Div>
</Div>

<Div id = "right">
<Div id = "sidebar">
<Div id = "menu_title"> about me </div>
<Div id = "menu_body"> www. bKjia. c0m </div>
</Div>
</Div>

<Div id = "footer">
Copyright 2007
</Div>
</Div>

<Body>
</Html>
 

1 2 3 4 5 6 7 8

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.