森林之原
五月 23, 2012, 11:15:46 pm *
歡迎光臨, 訪客. 請先 登入註冊一個帳號.

請輸入帳號, 密碼以及預計登入時間
新聞: CPG 1.4.3 繁體中文完成,請到 CPG 的版面下載。
 
   首頁   說明 搜尋 日曆 登入 註冊  
頁: [1] 2   向下
  寄送主題  |  列印  
作者 主題: 臭酸掉的問題~如何於論壇首頁加入隨機照片  (閱讀 10359 次)
0 會員 以及 1 訪客 正在閱讀本篇主題.
itski
訪客
« 於: 一月 11, 2005, 03:13:08 am »

雖然好像是臭酸調的問題

但是我找不到 smiley01_041   

有人知道嗎?  就是在論壇首頁可以加入隨機照片
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #1 於: 一月 11, 2005, 05:10:41 am »

http://coppermine.sourceforge.net/board/index.php?topic=13255.0
向版主檢舉   已記錄

itski
訪客
« 回覆文章 #2 於: 一月 11, 2005, 06:25:27 am »


Andrew大 超喜歡訓練我看英文的

每次看到整篇是英文的網頁都沒有耐心看下去...........  已經3年沒碰英文了
待我仔細觀來  謝謝
向版主檢舉   已記錄
itski
訪客
« 回覆文章 #3 於: 一月 11, 2005, 07:32:52 am »

Ok here we go:

In your case create a file e.g 'gallery_side_random_block.php' in you coppermine dir, put the code below in it and change the path to your '/gallery' and correct the connection to your mySql database, further you could change the number of dispayed thumbs with 'LIMIT 0,4' on row 30 to the amount you like. Now there are random 4 thumbs vertically displayed.


<?php

//***Enter Path information here***
//***absolute path to main coppermine directory***

$copperminepath = '/gallery'; //***YOU MUST CHANGE THIS***

//This connects to the mysql DB
//***change username and password below***

$MZrandompic = @mysql_connect('localhost', 'root', ''); //***YOU MUST CHANGE THIS***

if (!$MZrandompic) {
echo( '<p>Unable to connect to the ' .
'database server at this time.</p>' );
exit();
}

//select photo DB
//***YOU MUST CHANGE THIS***

if (! @mysql_select_db('coppermine') ) {
die( '<p>Unable to locate the picture ' .
'database at this time.</p>' );
}

//This gets a random picture record from the database and
//the picture's location and displays it

$MZresult = @mysql_query("SELECT * FROM cpg11d_pictures ORDER BY RAND() LIMIT 0,4");
if (!$MZresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}

while ( $MZrow = mysql_fetch_array($MZresult) ) {

// $albumid = $MZrow['aid']; //This gets the picture's associated album name
$pos = $MZrow['pid']; //This finds the picture's coppermine location

echo('<P ALIGN=center>');

echo('<a target = "_new" href="' . $copperminepath . '/displayimage.php?album=' . $albumid .
'&pos=-' . $pos . '">'); //make thumbnail clickable

echo('<IMG SRC="' . $copperminepath . '/albums/'); //append base dir structure
echo($MZrow['filepath'].thumb_.$MZrow['filename'] .
'" alt=' . $MZrow['filename'] . ' '. 'border=0 width=80 height=50>' . '[/url]'); //outputs path from /userspics
}

//This displays the picture's album name and
//links it to the coppermine album

$MZalbumresult = @mysql_query("SELECT * FROM cpg11d_albums WHERE aid = '$albumid'");
if (!$MZalbumresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}

while ( $MZalbumname = mysql_fetch_array($MZalbumresult) ) {
echo('<FONT SIZE=1>');
echo('<P ALIGN=center>');

echo('<a href="' . $copperminepath .
'/thumbnails.php?album=' . $albumid . '">' .
$MZalbumname['title'] . '[/url]' . '</p>');
}

if (! @mysql_select_db('coppermine') ) {
die( '<p>Unable to reload the main website ' .
'database at this time.</p>' );
}

?>
-------------------------------------------------------------------------------------------------------------------------------------------------------

Go to your sidenav.tpl and add the code below to your table/block 'my gallery' section (change to he right path).

<?php
<?php include("/inetpub/coppermine/gallery_side_random_block.php");>
?>


紅色那句的  sidenav.tpl我找不到ㄟ

向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #4 於: 一月 11, 2005, 12:07:03 pm »

因為 sidenav.tpl 你要自己寫, 然後在 sidenav.tpl 加上 <?php include 就會在 sidenav.tpl 出現隨機照片.
看你要把隨機照片放在哪裡就在哪裡加上 <?php include, 不一定要在 sidenav.tpl 裡面
向版主檢舉   已記錄

itski
訪客
« 回覆文章 #5 於: 一月 11, 2005, 09:51:11 pm »

那如果我要在我論壇的首頁加入隨機圖片
<?php include("/phpbb/gallery/gallery_side_random_block.php");> 這一句要加在哪一個檔案呢?
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #6 於: 一月 11, 2005, 09:53:11 pm »

你是用哪個論壇? SMF是 BoardIndex.template.php
向版主檢舉   已記錄

itski
訪客
« 回覆文章 #7 於: 一月 11, 2005, 09:59:28 pm »

我的CPG資料夾是跟phpbb建立在同一個資料庫(資料庫名稱phpbb)
不知道我的gallery_side_random_block.php這樣改對不對
程式碼:
<?php 

//***Enter Path information here*** 
//***absolute path to main coppermine directory*** 

$copperminepath 'phpbb/gallery'//***YOU MUST CHANGE THIS*** 

//This connects to the mysql DB 
//***change username and password below*** 

$MZrandompic = @mysql_connect('馬賽克''馬賽克'''); //***YOU MUST CHANGE THIS*** 

if (!$MZrandompic) { 
echo( 
'<p>Unable to connect to the ' 
'database server at this time.</p>' ); 
exit(); 


//select photo DB 
//***YOU MUST CHANGE THIS*** 

if (! @mysql_select_db('phpbb') ) { 
die( 
'<p>Unable to locate the picture ' 
'database at this time.</p>' ); 


//This gets a random picture record from the database and 
//the picture's location and displays it 

$MZresult = @mysql_query("SELECT * FROM cpg132_pictures  ORDER BY RAND() LIMIT 0,4"); 
if (!
$MZresult) { 
die(
'<p>Error performing query: ' mysql_error() . 
'</p>'); 


while ( 
$MZrow mysql_fetch_array($MZresult) ) { 

// $albumid = $MZrow['aid']; //This gets the picture's associated album name 
$pos $MZrow['pid']; //This finds the picture's coppermine location 

echo('<P ALIGN=center>'); 

echo(
'<a target = "_new" href="' $copperminepath '/displayimage.php?album=' $albumid 
'&pos=-' $pos '">'); //make thumbnail clickable 

echo('<IMG SRC="' $copperminepath '/albums/'); //append base dir structure 
echo($MZrow['filepath'].thumb_.$MZrow['filename'] . 
'" alt=' $MZrow['filename'] . ' ''border=0 width=80 height=50>' '</a>'); //outputs path from /userspics 


//This displays the picture's album name and 
//links it to the coppermine album 

$MZalbumresult = @mysql_query("SELECT * FROM cpg132_albums WHERE aid = '$albumid'"); 
if (!
$MZalbumresult) { 
die(
'<p>Error performing query: ' mysql_error() . 
'</p>'); 


while ( 
$MZalbumname mysql_fetch_array($MZalbumresult) ) { 
echo(
'<FONT SIZE=1>'); 
echo(
'<P ALIGN=center>'); 

echo(
'<a href="' $copperminepath 
'/thumbnails.php?album=' $albumid '">' 
$MZalbumname['title'] . '</a>' '</p>'); 


if (! @
mysql_select_db('phpbb') ) { 
die( 
'<p>Unable to reload the main website ' 
'database at this time.</p>' ); 


?>

向版主檢舉   已記錄
itski
訪客
« 回覆文章 #8 於: 一月 11, 2005, 10:00:07 pm »

雿?典??憯? SMF??BoardIndex.template.php

我是用phpbb
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #9 於: 一月 11, 2005, 10:14:14 pm »

雿?典??憯? SMF??BoardIndex.template.php

我是用phpbb

phpbb我不熟, 不過應該是 /templates/subSilver/index_body.tpl

為什麼你用引用會亂碼?
向版主檢舉   已記錄

itski
訪客
« 回覆文章 #10 於: 一月 12, 2005, 01:02:02 am »

阿摘

我按完引言  然後引言跑到下面的快速回覆框框理

然後我直接按發表文章   就變這樣了
向版主檢舉   已記錄
jefferson
初學者
*
離線 離線

文章: 5


« 回覆文章 #11 於: 七月 11, 2005, 12:04:56 pm »

我已完成了~~~!!
網址如下~~!!
http://htszone.no-ip.info/photo.php
我可以用 html 的語法插入網頁中嗎??
我該如何做呢???
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #12 於: 七月 11, 2005, 12:56:24 pm »

只要把程式碼放在
<?php
?>
裡面就可以了

然後網頁的副檔名改成 .php
向版主檢舉   已記錄

jefferson
初學者
*
離線 離線

文章: 5


« 回覆文章 #13 於: 七月 11, 2005, 05:59:39 pm »

只要把程式碼放在
<?php
?>
裡面就可以了

然後網頁的副檔名改成 .php


這個我知道~~~!!
因為我要把他引用到 附檔名為 html 的網頁~~~!!
不知如何加上去
向版主檢舉   已記錄
Andrew::
魔,羯
*
離線 離線

文章: 217



個人網站
« 回覆文章 #14 於: 七月 11, 2005, 08:42:58 pm »

預設的php和apache設定是不能把php程式碼放進html的
如果你要讓apache能夠處理html裡面的php, 記得沒錯的話應該是這樣
AddType application/x-httpd-php .php .html
跟原來的一樣只要加上 .html 就可以了

通常是不建議這樣做, 因為現在apache會將每個html檔都以php來處理, 就算裡面沒有php
所以會有點慢
向版主檢舉   已記錄

頁: [1] 2   向上
  寄送主題  |  列印  
 
前往:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006, Simple Machines LLC Valid XHTML 1.0! Valid CSS!