五、制作功能接口(2) 下面来正式的看看,我们共要实现的功能进行的包装 ------------ArticleUtil.php---------------- ?php//显示文章列表的函数//getArticleList(文章类别, 排序方法, 当前显示第几页, 每页显示几条)function getArticleList($catId, $ord
五、制作功能接口(2)
下面来正式的看看,我们共要实现的功能进行的包装
------------ArticleUtil.php----------------
这段代码是不是就简单多了啊?这就是自己对mysql函数进行包装的好处!
下面来研究一下他们是怎么实现我们的功能的呢。
“php开发文章列表”--------getArticleList(1, "id DESC", $page, 5)
“asp开发文章列表”--------getArticleList(2, "id DESC", $page, 5)
“php开发热点文章列表”----getArticleList(1, "clicks DESC, id DESC", 1, 3)
“asp开发热点文章列表”----getArticleList(2, "clicks DESC, id DESC", 1, 3)
“asp开发最新文章”--------getArticleList(2, "id DESC", 1, 3)
“添加新文章”-------------addArticle($data)
“察看文章”---------------getArticle($id)
六、对smarttemplate类进行包装(革命尚未成功,同志仍须努力)
具体的smarttemplate的使用这里就不讲了,不然口水讲没了,都讲不完。下面这个是具体的对包装函数
-------------ParseTpl.php----------------
<span><textarea> <?php function renderTpl($viewFile, $data){
$page = new SmartTemplate($viewFile);
foreach($data as $key=>$value){
if(isset($value[data])){
$page->assign($key, $value[data]);
unset($value[data]);
$page->assign($key."_page", $value);
} else {
$page->assign($key, $value);
}
}
$page->output();
}
?>
</textarea> </span>

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
