这是左侧代码,连接右侧的内容的,帮我写一个for循环,就可以直接呈现出来给用户。我后台加入数据,就直接可以循环到前台。右侧是内容。我后台做好了。
<?
$id=$_GET["id"];
if($id==null)
$id=1;
?> <img src="images/news_1.jpg" width="740" height="46" />
<map name="Map4MapMapMap" id="Map4MapMapMap">
<area shape="rect" coords="196,19,233,41" href="#" />
</map></td>
</tr>
<tr>
<td height="1" colspan="3" align="left" valign="top" bgcolor="#bfbfbf"></td>
</tr>
<tr>
<td width="199" align="left" valign="top">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==1) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=1" class="font">手机“随身学”学习软件荣获索尼爱立信杯第三届中国手机应用大赛最佳手机学习工具金枝奖 </a></strong></span></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==2) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=2" class="font">艾华-文曲星“随身学”系统参与金枝奖角逐</a></strong></span></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==3) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=3" class="font">Iava虚拟机手机应用开发平台参与金枝奖角逐</a></strong></span></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="1" bgcolor="#bfbfbf"></td>
<?
$file="news".$id.".php";
include($file);
?>
<?
$id=$_GET["id"];
if($id==null)
$id=1;
?> <img src="images/news_1.jpg" width="740" height="46" />
<map name="Map4MapMapMap" id="Map4MapMapMap">
<area shape="rect" coords="196,19,233,41" href="#" />
</map></td>
</tr>
<tr>
<td height="1" colspan="3" align="left" valign="top" bgcolor="#bfbfbf"></td>
</tr>
<tr>
<td width="199" align="left" valign="top">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==1) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=1" class="font">手机“随身学”学习软件荣获索尼爱立信杯第三届中国手机应用大赛最佳手机学习工具金枝奖 </a></strong></span></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==2) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=2" class="font">艾华-文曲星“随身学”系统参与金枝奖角逐</a></strong></span></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor=<? if($id==3) echo "#B9C4D4"; else echo "#EAEEF2"; ?>><span class="font"> <strong><a href="news.php?id=3" class="font">Iava虚拟机手机应用开发平台参与金枝奖角逐</a></strong></span></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="1" bgcolor="#bfbfbf"></td>
<?
$file="news".$id.".php";
include($file);
?>
{
这里的就不会写了,怎么能让他循环,并且把标题font也从后台获取。
}
你加了
<?
$file="news".$id.".php";
include($file);
?>
又说连接到数据库了,又给出了半个for还真是晕了,到底是什么状况啊?
<?
for($i=1;$i<$i[max];$i++)
{
echo"</table>";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td>";
echo"<table width="100%" border="0" cellspacing="0" cellpadding="0">";
echo"<tr>";
echo"<td bgcolor=";
if($id==2) echo "#B9C4D4";
else echo "#EAEEF2";
echo">" ;
echo"<span class='font'>";
echo" ";
echo" ";
echo" ";
echo" ";
echo"<strong>";
echo"<a href='news.php?id=2' class='font'>xxxxxxxxxxxxxxxxxxx </a> </strong> </span> </td></tr> ";
}
?>
最傻瓜的写法!一看就懂
<?
$file="news".$id.".php";
include($file);
?>
这个是意思是左侧点击,id会变化,右侧跟出相同id的新闻。
这是个前台。我的意思是,后台已经连接上来。现在就写前台就可以了。
我的for语句应该不对!!你们给我写个正确的!!谢谢了。
大体上这样 还有xxxxxxxxxxxxxxxxxxx 我不知道这边是你自己写的还是从其他地方弄到的。暂且就是有规律的调用吧!
$i<$i[max]; 中$i[max]这个条件表示最大!要看你的ID最大多少! 从你代码上看不出什么东西!我就按照一般有规律的写出来!没测试
把font一起写入数据库多出来就行了