Home »
FUDforum Development »
Plugins and Code Hacks »
top_title_code
top_title_code [message #30557] |
Fri, 03 March 2006 03:13 |
oswdcn
Messages: 5 Registered: March 2006
Karma:
|
Junior Member |
|
|
<?php /**************************************************************
*时间:2005-07-29
*功能:每行标题限制22个14像素中文字之内,每行显示两条数据记录
*并且每个单独标题字数在9-11个之间才能取得最佳显示效果
*author:oswd(at)oswd(dot)cn
*name:top_title_two
**************************************************************/
require_once('Connections/testconn.php');
mysql_select_db($database_your_connection, $your_connection);
$query_rsContent = "SELECT * FROM contents order by id desc limit 20";
$rsContent = mysql_query($query_rsContent, $your_connection) or die(mysql_error());
//$row_rsContent = mysql_fetch_assoc($rsContent);
$totalRows_rsContent = mysql_num_rows($rsContent);
$i=0;
$j=0;
$length = 0;
$txt_title="";
echo "<table bgcolor=\"#ffffff\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"338\" class=\"ywheight\">";
echo "<tr><td><img src=\"images/gbindex_r7_c3.jpg\"></td></tr>";
//echo "<table bgcolor=\"#FFFFEE\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">\n";
//echo "<tr><td><img src=\"images/l_2.gif\" width=\"4\" height=\"6\" hspace=\"3\">\n";
echo "<tr><td>·";
//echo "<th bgcolor=\"#3399FF\"> </th><tr><td><img src=\"images/l_2.gif\" width=\"4\" height=\"6\" hspace=\"3\">\n";
//echo "<th bgcolor=\"#3399FF\"> </th><tr><td><div id=\"titles_style\">[ 数 码 ]</div>\n";
//echo "<tr><td><div id=\"titles_style\">[ 数 码 ]</div>\n";
while($row=mysql_fetch_object($rsContent)){
//$title = $row->title;
$txt_title = $row->txt_title;
$id = $row->id;
//$dates = $row->dates;
$length = strlen($txt_title);
if($j>=2)
{
//echo "</td></tr><tr><td><img src=\"images/l_2.gif\" width=\"4\" height=\"6\" hspace=\"3\">\n";
echo "</td></tr><tr><td>·";
echo "<a href=\"viewinfos.php?id=$id\" target=\"_blank\">$txt_title</a>";
echo " ";
$i=$length+1;
$j=1;
}
else
{
if($i+$length<=100){
echo "<a href=\"viewinfos.php?id=$id\" target=\"_blank\">$txt_title</a>";
echo " ";
$i=$length+1;
$j=$j+1;
}
else
{
echo "</td></tr><tr><td>";
echo "<a href=\"viewinfos.php?id=$id\" target=\"_blank\">$txt_title</a>";
echo " ";
$i=$length+1;
$j=1;
}
}
}
echo "</td></tr>";
echo "<tr><td><img src=\"images/gbindex_r7_c33.jpg\"></td></tr>";
echo "</table>";
mysql_free_result($rsContent); ?>
|
|
|
Goto Forum:
Current Time: Tue Nov 26 08:33:24 GMT 2024
Total time taken to generate the page: 0.04160 seconds