
我去掉ㄌ秀出新進圖片的功能....只留下隨機秀圖...
但是她一次秀三張.......誰可以交我怎樣改成只秀兩張?
版主: 版主管理群

代碼: 選擇全部
<table width="100%" border="0" cellpadding="3" cellspacing="1" width="100%" class="forumline" HEIGHT=200>
<th colspan="2" align="center" class="thTop" width="20%"> 論壇相簿隨機圖片 </th>
<tr>
<!-- BEGIN images -->
<td class="row1" nowrap onMouseOver="this.style.backgroundColor='#eaeaea'" onMouseOut="this.style.backgroundColor='#f5f5f5'" WIDTH="25%"><span class="forumlink">
<a href="../4images/details.php?image_id={images.image_url}" class="index" target="_top"><img src="{images.image}" border="0" onload="javascript:if(this.height>150) this.height=150"><BR>{images.image_title}</a>{images.username}<BR>
<!-- END images -->
</table>
代碼: 選擇全部
<?
/***************************************************************************
* showpic.php
* ------------------
* begin : Sunday, Nov 17, 2002
* copyright : (C) 2002 Tofu Chen
* email : tofu0913@ms10.url.com.tw
*
* $Id: news.php,v 1.2 2002/05/31 0:37:00 sj26 Exp $
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
define('IN_PHPBB', true);
$phpbb_root_path = "./";
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX, $session_length);
init_userprefs($userdata);
//
// End session management
//
//
// Start read 4images DB
//
/*$pnlink = mysql_connect("資料庫名稱","連資料庫帳號","密碼") or die ("mysql_connect() failed.");
mysql_select_db("phpbb_", $pnlink) or die ("mysql_connect() failed."); */
//$pnquery = mysql_query("SELECT * FROM 4images_images WHERE cat_id ='1' OR cat_id ='3' OR cat_id ='5' OR cat_id ='7' OR cat_id ='9' order by image_date desc limit 3");
//$pnquery = mysql_query("SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY RAND() desc LIMIT 3");
$pnquery = "SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY RAND() desc LIMIT 3";
// set template
$template->set_filenames(array("body" => "showpic_body2.tpl"));
if ( !($result = $db->sql_query($pnquery)) )
{
message_die(GENERAL_ERROR, '無法取得工作內容!!', '', __LINE__, __FILE__, $pnquery);
}
//while ($myrow = mysql_fetch_row($pnquery)) {
while ($myrow = $db->sql_fetchrow($result)) {
$image=($myrow[2]=="")?"http://hpo14.myftp.org/4images/templates/4waters/icons/jpg.gif":"http://hpo14.myftp.org/4images/data/thumbnails/".$myrow[1]."/".$myrow[2];
$username =($myrow[4]=="")?"":"(".$myrow[4].")";
$template->assign_block_vars("images",array(
"image_url" => $myrow[0],
"image" => $image,
"image_title" => $myrow[3],
"username" => $username
));
}
$pnquery = "SELECT A.image_id,A.cat_id,A.image_thumb_file,A.image_name,B.username FROM 4images_images A, phpbb_users B WHERE A.user_id=B.user_id ORDER BY image_id desc LIMIT 1";
if ( !($result = $db->sql_query($pnquery)) )
{
message_die(GENERAL_ERROR, '無法取得工作內容!!', '', __LINE__, __FILE__, $pnquery);
}
if ($row = $db->sql_fetchrow($result)) {
$image=($row[2]=="")?"http://hpo14.myftp.org/4images/templates/4waters/icons/jpg.gif":"http://hpo14.myftp.org/4images/data/thumbnails/".$row[1]."/".$row[2];
$username =($row[4]=="")?"":"(".$row[4].")";
$template->assign_block_vars("new_images",array(
"image_url" => $row[0],
"image" => $image,
"image_title" => $row[3],
"username" => $username
));
}
//
// End read 4images DB
//
//
// Generate the page
//
$template->assign_vars(array(
"T_TITLE" => $lang['Random_Image'],
"T_TITLE2" => $lang['New_Image']
));
$template->pparse('body');
//mysql_close($pnlink);
?>