1 頁 (共 1 頁)

[問題]簡易子版面1.3 最後發表的文章最尾...

發表於 : 2006-06-30 03:13
233062306
問題外掛:簡易子版面1.3
參考連結:http://phpbb-tw.net/phpbb/viewtopic.php?p=202043#202043
使用版本:phpBB 2.0.21
網站位置:http://2306zone.com/index.php
狀況描述: 最後發表的文章最尾有時會出現 ? 的情況

代碼: 選擇全部

#
#--------[OPEN]----------------
#
index.php

# 
#--------[ FIND ]---------------- 
# 
      default: 
         $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id 

# 
#-----[ IN LINE FIND 繼續在這一行尋找 ]------------------------ 
#
u.user_id

# 
#-----[ IN LINE AFTER, ADD 在指定之後, 加上 ]---------------- 
#
,substring(pt.topic_title,1,[color=red]18[/color]) as topic_title
上面的18應該是主題最多的byte數目
先看a圖...
圖檔
這個主題全名是原來男人之苦入面果個係梁靖琪黎ga@o@
(抱歉...香港的論壇...用口語= =)
原來男人之苦入面果就剛剛好18 byte
沒有錯誤~一切平常^^

但到了b圖
圖檔
最尾多了一個?
這個主題全名是[轉貼] 有趣女性名字資料-香港的某大學統計
可惜...[轉貼] 有趣女性名只有17 byte
如果電腦用1 byte去顯示(最多18 byte)
就只會出現?(中文字耍2 byte唷^^)

簡單來說...如果主題不要一次性抽出18 byte的話 , 最後一個字就會變了?

我到過水色看看...它的最後發表是以...顯示的~
但小分不才...搞了半天都搞不好...
也看過心大的文章http://phpbb-tw.net/phpbb/viewtopic.php?p=237418#237418
(上半部分我想只是Fily兄的小錯誤而且...而, t.topic_title, t.topic_id我猜是其他外掛...猜錯不要笑><")
#
#-----[ FIND ]-----
#

代碼: 選擇全部

FROM ((( " . FORUMS_TABLE . " f 
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) 
            LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_id = p.topic_id ) 
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) 
            ORDER BY f.cat_id, f.forum_order"; 
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

FROM (((( " . FORUMS_TABLE . " f 
            LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) 
            LEFT JOIN " . TOPICS_TABLE . " t ON t.topic_id = p.topic_id ) 
            LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) 
            LEFT JOIN " . TOPICS_TABLE . " pt ON pt.topic_id  = p.topic_id  ) 
            ORDER BY f.cat_id, f.forum_order"; 
但沒有效...

我試過判斷一個文章是否能夠顯示出18 byte , 如否 , 就用17 byte...(index.php及veiwforum.php都有)
可惜小弟對php實在了解不深...只是用c++的語法慢慢譯成php= =...最後當然失敗...
希望大大指點指點...
送上index一個 :cry: http://2306zone.com/index.zip

發表於 : 2006-06-30 18:12
*tytsim*
如果支援
mb_substr

改做

代碼: 選擇全部

,mb_substr(pt.topic_title,1,18,'big5') as topic_title
試試看

發表於 : 2006-06-30 19:01
心靈捕手
To 233062306:

該 (簡易子版面) 外掛預設, 顯示標題 (topic_title) 的前 18 個字;
若您想要在末端顯示 '...' 的話,
則建議您:
移除該設定, 加裝其他外掛 (二選一)

1. last_topic_title_index
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?t=7947
http://phpbb-tw.net/phpbb/viewtopic.php?p=210148#210148

2. Last Topic Title on Index
參考連結:
http://www.phpbb.com/phpBB/viewtopic.php?t=350442

發表於 : 2006-07-01 01:32
233062306
阿...我又把code和quote搞亂了= =...

謝心大~其實之前我都試過第1支外掛 :lol:
現在兩個外掛都試過了..出現一樣的話問題...

我先用了第一個方法來說說吧~
$board_config['topic_title_index_size'] , 我set了16

[新聞] 蘋果電腦股票一天內大漲 9.87%<---這是原本的...
到了主頁看...就出現[新聞] 蘋果電腦?..<---的確有出現..
問題是...這個中文字要用2 byte來存放 , 要電腦只有1 byte , 所以變了?

我跑去吉川大大的遊戲非官方都是這樣子...當不夠byte存放大文字時就出現 ?..
再跑去水色...竟然沒有這個問題~.~ :-o
我數數...最後發表的主題byte數是不定的...有時20 , 有時18...好像是電腦會判斷適合的byte數...
不像last_topic_title_index那般...設定了$board_config['topic_title_index_size'] 就不會自行改動...

發表於 : 2006-07-01 13:51
*tytsim*
,mb_substr(pt.topic_title,1,18,'big5') as topic_title
你試試

發表於 : 2006-07-01 16:12
233062306
我把

代碼: 選擇全部

,substring(pt.topic_title,1,18) as topic_title
改做

代碼: 選擇全部

,mb_substr(pt.topic_title,1,18,'big5') as topic_title
出現

代碼: 選擇全部

Could not query forums information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(pt.topic_title,1,18,'big5') as topic_title FROM ((( phpbb

SELECT f.*, p.post_time, p.post_username, u.username, u.user_id,mb_substr(pt.topic_title,1,18,'big5') as topic_title FROM ((( phpbb_forums f LEFT JOIN phpbb_posts p ON p.post_id = f.forum_last_post_id ) LEFT JOIN phpbb_users u ON u.user_id = p.poster_id ) LEFT JOIN phpbb_topics pt ON pt.topic_id = p.topic_id ) ORDER BY f.cat_id, f.forum_order

Line : 174
File : index.php

發表於 : 2006-07-02 00:16
jwxinst
是不是你的max lenght不夠啊?

發表於 : 2006-07-02 15:17
*tytsim*
233062306 寫:我把

代碼: 選擇全部

,substring(pt.topic_title,1,18) as topic_title
改做

代碼: 選擇全部

,mb_substr(pt.topic_title,1,18,'big5') as topic_title
出現

代碼: 選擇全部

Could not query forums information

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(pt.topic_title,1,18,'big5') as topic_title FROM ((( phpbb

SELECT f.*, p.post_time, p.post_username, u.username, u.user_id,mb_substr(pt.topic_title,1,18,'big5') as topic_title FROM ((( phpbb_forums f LEFT JOIN phpbb_posts p ON p.post_id = f.forum_last_post_id ) LEFT JOIN phpbb_users u ON u.user_id = p.poster_id ) LEFT JOIN phpbb_topics pt ON pt.topic_id = p.topic_id ) ORDER BY f.cat_id, f.forum_order

Line : 174
File : index.php
看不到原來是sql