This is my learning notes written in the static process of my PHP Technology page. I hope this will help you. 1. Basic Idea (1) when we add or update news, we create or update html pages synchronously to solve the real-time problem and put the generated html file path in the database; (2) Design a template file through the Template
This is my learning notes written in the static process of my PHP Technology page. I hope this will help you. 1. Basic Idea (1) when we add or update news, we create or update html pages synchronously to solve the real-time problem and put the generated html file path in the database; (2) Design a template file through the Template
This is my learning notes written in the static process of my PHP Technology page. I hope this will help you.
1. Basic Ideas
(1) When we add or update news, we create or update html pages synchronously to solve the real-time problem and put the generated html file path in the database;
(2) Design a template file and create a static page through the template;
(3) access html static pages each time;
2. The database follows the above database structure. It is best to clear the data
3. Code
News_list.php (News list page)
SqlHelper. class. php $ conn = mysql_connect ("localhost", "root", "root"); if (! $ Conn) {die ("connection failed");} mysql_select_db ("static_pages_news", $ conn); mysql_query ("set names utf8 "); $ SQL = "select * from news order by id"; $ res = mysql_query ($ SQL); header ("content-type: text/html; charset = UTF-8 "); echo "News list"; echo "Add news
"; Echo"
"; Echo"
Id |
Title |
View news |
Modify news |
"; While ($ row = mysql_fetch_assoc ($ res) {echo"
{$ Row ['id']} |
{$ Row ['title']} |
View Details |
Modify details |
";} Echo"
"; Mysql_free_result ($ res); mysql_close ($ conn);?>
Add_news.html (Add news page)
Add news
Update_newsui.php (modify the news page)
"; Echo""; Echo"
"; Echo"
"; Echo"{$ Row ['content']}
"; Echo""; Echo"
"; Echo"
";}Else {echo" the news you are viewing does not exist ";}?>
NewsAction. php (ADD and modify the page for processing news requests)
Template. tpl (the template of the news presentation page)
% Title %
% Title %
%content%
Back to list