SoFunction
Updated on 2025-04-13

Create the world's simplest PHP development model page 4/5

, 5); 
$data[phphotlist] = getArticleList(1, "clicks DESC, id DESC", 1, 3); 
$data[aspnewlist] = getArticleList(2, "id DESC", 1, 3); 
$data[asphotlist] = getArticleList(2, "clicks DESC, id DESC", 1, 3); 
dbDisconnect(); 

renderTpl(’’, $data); 

?> 

If you carefully observe the difference between the front and back, you just add a line of code to implement this change. How do you feel? Isn't it super simple?

In fact, the benefits of this design pattern are not just this:
1. The core code of the program can be isolated and managed to facilitate future program management and maintenance
2. It is also very scalable for the program. Assuming that the product list is to be added, can I do this? Write the management of the product into a unified database operation interface, then simply modify the template file and add it to the product list, and finally add a line of function call code to it, which can be implemented.
3. Code reuse. If you are a small and medium-sized enterprise website, then this will benefit you the most, because the design structure of this type of website is almost the same. You may just need to change the style of the template to make money.

It seems that this model has brought you a lot of benefits?


--------------------------
<a href="">Add a new article</a><hr>
<table ID="Table1">
<tr><th>asp development article</th></tr>
<!-- BEGIN asplist -->
<tr><td>{id}--<a href="?id={id}">{title}</a></td></tr>
<!-- END asplist -->
</table>
<!-- BEGIN asplist_page -->
<script src="" language="javascript"></script>
<script language="javascript">
recordCount = {recordCount}; //Total number of records
show = {pageSize}; //The number of records displayed per page
pageShow = 10; //The number of page connections displayed per page
pageCount = {pageCount}; //Total number of pages
pageNow = {page}; // Current page count
pageStr = "?page=_page_"; //Page connection
(showListPage(recordCount, show, pageShow, pageCount, pageNow, pageStr));
</script>
<!-- END asplist_page -->
<hr>
<table ID="Table4">
<tr><th>asp hot articles</th></tr>
<!-- BEGIN asphotlist -->
<tr><td>{id}--<a href="?id={id}">{title}</a></td></tr>
<!-- END asphotlist -->
</table>


--------------------------
<?php 

require_once ""; 

dbConnect(); 
$data = array(); 
$data[asplist] = getArticleList(2, "id DESC", (int)$_GET
Previous page12345Next pageRead the full text