<?php /********************************
定义:
cid =栏目类型
showh=每行显示几张图片
picw =显示图片的宽度
pich =显示图片的高度
btablew=外层表格宽度
btableh=外层表格高度
stablew=内层表格宽度
stableh=内层表格高度
stableh2=内层表格高度
*********************************/
function picimage($a){
if(is_array($a))
{
$cid = $a['cid'];
$showh = $a['showh'];
$tablename = $a['tablename'] ? $a['tablename'] : "cms_article";
$picw = $a['picw'];
$pich = $a['pich'];
$btablew = $a['btablew']; .
$btableh = $a['btableh'];
$stablew = $a['stablew'];
$stableh = $a['stableh'];
$stableh2 = $a['stableh2'];
//$width = $a['width'];
//$tip = $a['tip'];
} $cid,$showh,$tablename,$picw,$pich,$btablew,$btableh,$stablew,$stableh,$stableh2
global $db;
$query = "select * from ".$tablename." where cid=".$cid."";
$result = mysql_query($query);
$p = $showh;
$i = 0;
echo "<table width=\"".$btablew."\" height=\"".$btableh."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
while ($row=mysql_fetch_object($result)){
if($i== 0)
echo "<tr>";
echo "<td>";
echo "<table width=\"".$stablew."\" height=\"".$stableh."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td width=\"".$stableh2."\"><img src=\"".$row->pic."\" width=\"".$picw."\" height=\"".$pich."\"></td>";
echo "<td>".$row->title."</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
$i++;
if($i == $p){
echo "</tr>";
$i = 0;
}
}if($i<$p){
for(;$i<$p;$i++){
echo "<td></td>";
}
echo "</tr>";
}
echo "</table>";
}
?>
调用页
<?php
header('Content-Type: text/html; charset=utf-8');
//include_once '1.php';
include_once 'include/config.inc.php';
include_once 'include/common.function.php';
include_once 'common.php';
?>
<?php picimage(
array(
'cid'=25,
'showh' = 2,
'picw' = 99,
'pich' = 130,
'btablew' = 633,
'btableh' = 304,
'stablew' = 318,
'stableh' = 152,
'stableh2' = 119,
)
);
?>出现错误:Parse error: syntax error, unexpected '=', expecting ')' in D:\AppServ\www\DSPHP\2.php on line 12
定义:
cid =栏目类型
showh=每行显示几张图片
picw =显示图片的宽度
pich =显示图片的高度
btablew=外层表格宽度
btableh=外层表格高度
stablew=内层表格宽度
stableh=内层表格高度
stableh2=内层表格高度
*********************************/
function picimage($a){
if(is_array($a))
{
$cid = $a['cid'];
$showh = $a['showh'];
$tablename = $a['tablename'] ? $a['tablename'] : "cms_article";
$picw = $a['picw'];
$pich = $a['pich'];
$btablew = $a['btablew']; .
$btableh = $a['btableh'];
$stablew = $a['stablew'];
$stableh = $a['stableh'];
$stableh2 = $a['stableh2'];
//$width = $a['width'];
//$tip = $a['tip'];
} $cid,$showh,$tablename,$picw,$pich,$btablew,$btableh,$stablew,$stableh,$stableh2
global $db;
$query = "select * from ".$tablename." where cid=".$cid."";
$result = mysql_query($query);
$p = $showh;
$i = 0;
echo "<table width=\"".$btablew."\" height=\"".$btableh."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
while ($row=mysql_fetch_object($result)){
if($i== 0)
echo "<tr>";
echo "<td>";
echo "<table width=\"".$stablew."\" height=\"".$stableh."\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
echo "<tr><td width=\"".$stableh2."\"><img src=\"".$row->pic."\" width=\"".$picw."\" height=\"".$pich."\"></td>";
echo "<td>".$row->title."</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
$i++;
if($i == $p){
echo "</tr>";
$i = 0;
}
}if($i<$p){
for(;$i<$p;$i++){
echo "<td></td>";
}
echo "</tr>";
}
echo "</table>";
}
?>
调用页
<?php
header('Content-Type: text/html; charset=utf-8');
//include_once '1.php';
include_once 'include/config.inc.php';
include_once 'include/common.function.php';
include_once 'common.php';
?>
<?php picimage(
array(
'cid'=25,
'showh' = 2,
'picw' = 99,
'pich' = 130,
'btablew' = 633,
'btableh' = 304,
'stablew' = 318,
'stableh' = 152,
'stableh2' = 119,
)
);
?>出现错误:Parse error: syntax error, unexpected '=', expecting ')' in D:\AppServ\www\DSPHP\2.php on line 12
$cid,$showh,$tablename,$picw,$pich,$btablew,$btableh,$stablew,$stableh,$stableh2
'cid'=>5,
'showh'=>2,
这样就对了 8楼那个 你 tm的鸟到一定程度了 非常鄙视