[問題]如何將相簿藝廊的隨機圖片等功能加到首頁??
版主: 版主管理群
[問題]如何將相簿藝廊的隨機圖片等功能加到首頁??
各位先進, 弟想將相簿藝廊的三個功能: 最近的公開圖片, 最高評分圖片, 以及隨機
圖片加到首頁裡顯示出來, 請問我該如何做呢??
圖片加到首頁裡顯示出來, 請問我該如何做呢??
提供一下原始random picture加在相簿藝廊首頁的程式碼:
小地嘗試將這一段加入index_body.tpl裡面, 結果只看到Random Picture的Title
卻無法看到相片??
不知道小弟是漏改了哪個地方呢? 還請前輩指教!!
代碼: 選擇全部
##############################################################
## MOD Title: Random Pictures
## MOD Author: Original 'Recent Pics' Code by Smartor < smartor_xp@hotmail.com >
## Modded by CLowN
## MOD Description:
## Shows random pictures underneath your recent uploaded pics
##
## MOD Requirements: Album version 2 by Smartor ( http://smartor.is-root.com )
##
## Author Recomendations: Highest Rated Pics by MarkFulton.com
##
## Installation Level: easy
## Installation Time: 2-3 minutes
##
## Files To Edit: 2
## album.php
## templates/ YOUR TEMPLET HERE /album_index_body.tpl
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]-------------------------------------------------------
#
album.php
#
#-----[ FIND ]-------------------------------------------------------
#
/*
+----------------------------------------------------------
| Start output the page
+----------------------------------------------------------
*/
#
#-----[ BEFORE, ADD ]-------------------------------------------------------
#
/*
+----------------------------------------------------------
| Random Pictures
| by CLowN
+----------------------------------------------------------
*/
if ($allowed_cat != '')
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['cols_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query rand pics information', '', __LINE__, __FILE__, $sql);
}
$randrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$randrow[] = $row;
}
if (count($randrow) > 0)
{
for ($i = 0; $i < count($randrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('rand_pics', array());
for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)
{
if( $j >= count($randrow) )
{
break;
}
if(!$randrow[$j]['rating'])
{
$randrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$randrow[$j]['rating'] = round($randrow[$j]['rating'], 2);
}
$template->assign_block_vars('rand_pics.rand_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $randrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $randrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $randrow[$j]['pic_id']),
'DESC' => $randrow[$j]['pic_desc']
)
);
if( ($randrow[$j]['user_id'] == ALBUM_GUEST) or ($randrow[$j]['username'] == '') )
{
$rand_poster = ($randrow[$j]['pic_username'] == '') ? $lang['Guest'] : $randrow[$j]['pic_username'];
}
else
{
$rand_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $randrow[$j]['user_id']) .'">'. $randrow[$j]['username'] .'</a>';
}\r
$template->assign_block_vars('rand_pics.rand_detail', array(
'TITLE' => $randrow[$j]['pic_title'],
'POSTER' => $rand_poster,
'TIME' => create_date($board_config['default_dateformat'], $randrow[$j]['pic_time'], $board_config['board_timezone']),
'VIEW' => $randrow[$j]['pic_view_count'],
'RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid("album_rate.$phpEx?pic_id=". $randrow[$j]['pic_id']) . '">' . $lang['Rating'] . '</a>: ' . $randrow[$j]['rating'] . '<br />') : '',
'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid("album_comment.$phpEx?pic_id=". $randrow[$j]['pic_id']) . '">' . $lang['Comments'] . '</a>: ' . $randrow[$j]['comments'] . '<br />') : '',
'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($randrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($randrow[$j]['pic_user_ip']) .'</a><br />' : ''
)
);
}
}
}
else
{
//
// No Pics Found
//
$template->assign_block_vars('no_pics', array());
}
}
else
{
//
// No Cats Found
//
$template->assign_block_vars('no_pics', array());
}
#
#-----[ OPEN ]-------------------------------------------------------
#
templates/ YOUR TEMPLET HERE /album_index_body.tpl
#
#-----[ FIND ]-------------------------------------------------------
#
<!-- BEGIN switch_user_logged_out -->
#
#-----[ BEFORE, ADD ]-------------------------------------------------------
#
<p />
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="thTop" height="25" colspan="{S_COLS}" nowrap="nowrap">Random Pictures</th>
</tr>
<!-- BEGIN no_pics -->
<tr>
<td class="row1" align="center" colspan="{S_COLS}" height="50"><span class="gen">{L_NO_PICS}</span></td>
</tr>
<!-- END no_pics -->
<!-- BEGIN rand_pics -->
<tr>
<!-- BEGIN rand_col -->
<td class="row1" width="{S_COL_WIDTH}" align="center"><a href="{rand_pics.rand_col.U_PIC}" {TARGET_BLANK}><img src="{rand_pics.rand_col.THUMBNAIL}" border="0" alt="{rand_pics.rand_col.DESC}" title="{rand_pics.rand_col.DESC}" vspace="10" /></a></td>
<!-- END rand_col -->
</tr>
<tr>
<!-- BEGIN rand_detail -->
<td class="row2"><span class="gensmall">{L_PIC_TITLE}: {rand_pics.rand_detail.TITLE}<br />
{L_POSTER}: {rand_pics.rand_detail.POSTER}<br />{L_POSTED}: {rand_pics.rand_detail.TIME}<br />
{L_VIEW}: {rand_pics.rand_detail.VIEW}<br />{rand_pics.rand_detail.RATING}{rand_pics.rand_detail.COMMENTS}{rand_pics.rand_detail.IP}</span>
</td>
<!-- END rand_detail -->
</tr>
<!-- END rand_pics -->
</table>
#
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------------------------------
#
# EoF
卻無法看到相片??
代碼: 選擇全部
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="thTop" height="25" colspan="{S_COLS}" nowrap="nowrap">Random Pictures</th>
</tr>
<!-- BEGIN no_pics -->
<tr>
<td class="row1" align="center" colspan="{S_COLS}" height="50"><span class="gen">{L_NO_PICS}</span></td>
</tr>
<!-- END no_pics -->
<!-- BEGIN rand_pics -->
<tr>
<!-- BEGIN rand_col -->
<td class="row1" width="{S_COL_WIDTH}" align="center"><a href="{rand_pics.rand_col.U_PIC}" {TARGET_BLANK}><img src="{rand_pics.rand_col.THUMBNAIL}" border="0" alt="{rand_pics.rand_col.DESC}" title="{rand_pics.rand_col.DESC}" vspace="10" /></a></td>
<!-- END rand_col -->
</tr>
<tr>
<!-- BEGIN rand_detail -->
<td class="row2"><span class="gensmall">{L_PIC_TITLE}: {rand_pics.rand_detail.TITLE}<br />
{L_POSTER}: {rand_pics.rand_detail.POSTER}<br />{L_POSTED}: {rand_pics.rand_detail.TIME}<br />
{L_VIEW}: {rand_pics.rand_detail.VIEW}<br />{rand_pics.rand_detail.RATING}{rand_pics.rand_detail.COMMENTS}{rand_pics.rand_detail.IP}</span>
</td>
<!-- END rand_detail -->
</tr>
<!-- END rand_pics -->
</table>
嗯, 小弟的網站並不是plus版的, 沒有portal.php等相關檔案可修改喔......吉川拓也 寫:多使用搜尋會比較好唷^^lasthero 寫:大大, 我忘了說, 我不是用4images system, 我是用album system.
http://phpbb-tw.net/phpbb/viewtopic.php?t=17211
檔案是死的 . 活用才是王道 ...lasthero 寫:嗯, 小弟的網站並不是plus版的, 沒有portal.php等相關檔案可修改喔......吉川拓也 寫:多使用搜尋會比較好唷^^lasthero 寫:大大, 我忘了說, 我不是用4images system, 我是用album system.
http://phpbb-tw.net/phpbb/viewtopic.php?t=17211
沒有導航就別改 portal.php 改 index ...
有問題在po討論^^
善用 搜尋 可以解決您 90% 的問題
頭腦清晰,選擇正確。 (╯▔︹▔)╯~╘═╛
頭腦清晰,選擇正確。 (╯▔︹▔)╯~╘═╛
各位大大, 弟已經成功了一半, 但是仍然出現問題(在標題列無法延展至整條):
index.php加入:
index_body.tpl加入:
請問弟哪邊要更正呢? 感激不盡!!
忘了說, 連"圖片名稱", "發表人"等標題都不見了@@.....
index.php加入:
代碼: 選擇全部
/*
+----------------------------------------------------------
| Random Pictures
| by CLowN
+----------------------------------------------------------
*/
if ($allowed_cat != '')
{
$sql = "SELECT p.pic_id, p.pic_title, p.pic_desc, p.pic_user_id, p.pic_user_ip, p.pic_username, p.pic_time, p.pic_cat_id, p.pic_view_count, u.user_id, u.username, r.rate_pic_id, AVG(r.rate_point) AS rating, COUNT(DISTINCT c.comment_id) AS comments
FROM ". ALBUM_TABLE ." AS p
LEFT JOIN ". USERS_TABLE ." AS u ON p.pic_user_id = u.user_id
LEFT JOIN ". ALBUM_CAT_TABLE ." AS ct ON p.pic_cat_id = ct.cat_id
LEFT JOIN ". ALBUM_RATE_TABLE ." AS r ON p.pic_id = r.rate_pic_id
LEFT JOIN ". ALBUM_COMMENT_TABLE ." AS c ON p.pic_id = c.comment_pic_id
WHERE p.pic_cat_id IN ($allowed_cat) AND ( p.pic_approval = 1 OR ct.cat_approval = 0 )
GROUP BY p.pic_id
ORDER BY RAND()
LIMIT ". $album_config['cols_per_page'];
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not query rand pics information', '', __LINE__, __FILE__, $sql);
}
$randrow = array();
while( $row = $db->sql_fetchrow($result) )
{
$randrow[] = $row;
}
if (count($randrow) > 0)
{
for ($i = 0; $i < count($randrow); $i += $album_config['cols_per_page'])
{
$template->assign_block_vars('rand_pics', array());
for ($j = $i; $j < ($i + $album_config['cols_per_page']); $j++)\r
{
if( $j >= count($randrow) )
{
break;
}
if(!$randrow[$j]['rating'])
{
$randrow[$j]['rating'] = $lang['Not_rated'];
}
else
{
$randrow[$j]['rating'] = round($randrow[$j]['rating'], 2);
}
$template->assign_block_vars('rand_pics.rand_col', array(
'U_PIC' => ($album_config['fullpic_popup']) ? append_sid("album_pic.$phpEx?pic_id=". $randrow[$j]['pic_id']) : append_sid("album_page.$phpEx?pic_id=". $randrow[$j]['pic_id']),
'THUMBNAIL' => append_sid("album_thumbnail.$phpEx?pic_id=". $randrow[$j]['pic_id']),
'DESC' => $randrow[$j]['pic_desc']
)
);
if( ($randrow[$j]['user_id'] == ALBUM_GUEST) or ($randrow[$j]['username'] == '') )
{
$rand_poster = ($randrow[$j]['pic_username'] == '') ? $lang['Guest'] : $randrow[$j]['pic_username'];
}
else
{
$rand_poster = '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $randrow[$j]['user_id']) .'">'. $randrow[$j]['username'] .'</a>';
}
$template->assign_block_vars('rand_pics.rand_detail', array(
'TITLE' => $randrow[$j]['pic_title'],
'POSTER' => $rand_poster,
'TIME' => create_date($board_config['default_dateformat'], $randrow[$j]['pic_time'], $board_config['board_timezone']),
'VIEW' => $randrow[$j]['pic_view_count'],
'RATING' => ($album_config['rate'] == 1) ? ( '<a href="'. append_sid("album_rate.$phpEx?pic_id=". $randrow[$j]['pic_id']) . '">' . $lang['Rating'] . '</a>: ' . $randrow[$j]['rating'] . '<br />') : '',
'COMMENTS' => ($album_config['comment'] == 1) ? ( '<a href="'. append_sid("album_comment.$phpEx?pic_id=". $randrow[$j]['pic_id']) . '">' . $lang['Comments'] . '</a>: ' . $randrow[$j]['comments'] . '<br />') : '',
'IP' => ($userdata['user_level'] == ADMIN) ? $lang['IP_Address'] . ': <a href="http://www.nic.com/cgi-bin/whois.cgi?query=' . decode_ip($randrow[$j]['pic_user_ip']) . '" target="_blank">' . decode_ip($randrow[$j]['pic_user_ip']) .'</a><br />' : ''
)
);
}
}
}
else
{
//
// No Pics Found
//
$template->assign_block_vars('no_pics', array());
}
}
else
{
//
// No Cats Found
//
$template->assign_block_vars('no_pics', array());
}
代碼: 選擇全部
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th class="thTop" height="25" colspan="{S_COLS}" nowrap="nowrap">Random Pictures</th>
</tr>
<!-- BEGIN no_pics -->
<tr>
<td class="row1" align="center" colspan="{S_COLS}" height="50"><span class="gen">{L_NO_PICS}</span></td>
</tr>
<!-- END no_pics -->
<!-- BEGIN rand_pics -->
<tr>
<!-- BEGIN rand_col -->
<td class="row1" width="{S_COL_WIDTH}" align="center"><a href="{rand_pics.rand_col.U_PIC}" {TARGET_BLANK}><img src="{rand_pics.rand_col.THUMBNAIL}" border="0" alt="{rand_pics.rand_col.DESC}" title="{rand_pics.rand_col.DESC}" vspace="10" /></a></td>
<!-- END rand_col -->
</tr>
<tr>
<!-- BEGIN rand_detail -->
<td class="row2"><span class="gensmall">{L_PIC_TITLE}: {rand_pics.rand_detail.TITLE}<br />
{L_POSTER}: {rand_pics.rand_detail.POSTER}<br />{L_POSTED}: {rand_pics.rand_detail.TIME}<br />
{L_VIEW}: {rand_pics.rand_detail.VIEW}<br />{rand_pics.rand_detail.RATING}{rand_pics.rand_detail.COMMENTS}{rand_pics.rand_detail.IP}</span>
</td>
<!-- END rand_detail -->
</tr>
<!-- END rand_pics -->
</table>
忘了說, 連"圖片名稱", "發表人"等標題都不見了@@.....
我照著上面的大大做.. 結果是一樣的...
也是出現Random Pictures .. 但是沒有任何圖片出現.....
可否有人詳細的寫一下解決方式...
我的站如下
http://rax.adsldns.org/forum/index.php
麻煩了~!
也是出現Random Pictures .. 但是沒有任何圖片出現.....
可否有人詳細的寫一下解決方式...
我的站如下
http://rax.adsldns.org/forum/index.php
麻煩了~!