$site_info = mysql_fetch_object ($sth);
function print_header ()
{
global $site_info;
print $site_info->header;
}
function print_body ()
{
global $site_info;
print nl2br ($site_info->body);
}
function print_links ()
{
global $site_info;
$links = explode ("n", $site_info->links);
$names = explode ("n", $site_info->link_names);
for ($i = 0; $i < count ($links); $i++)
{
print "ttt
<a href="$links[$i]">$names[$i]</a>
n<br>n";
}
}
?>
这种方法使得程序看起来比较简洁,而且执行速度也较快。
2、使用模板的方法
这种方法使得程序看起来更简洁,同样实现上面的功能,可用以下代码:
<html>
<head>
<title>%%PAGE_TITLE%%</title>
</head>
<body %%BODY_PROPERTIES%%>
<h1>%%PAGE_TITLE%%</h1>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td wi
| 对此文章发表了评论 |
