但對一般站長而言應該很夠用了
第一次發表如有觸犯版規尚祈見諒
若有使用上的問題請留言,謝謝!
這是完成的模樣:

我的站台安裝環境
Linux kernel 2.4.20
Apache 1.3.37
PHP 4.4.6
phpbbplus 1.53a UTF-8
代碼: 選擇全部
#
#-----[ OPEN 打開 ]------------------------------------------------
#
portal.php
#
#-----[ FIND 尋找 ]------------------------------------------------
#
//
// Recent Topics
//
#
#-----[ BEFORE, ADD 之前, 加上 ]------------------------------------
#
// Begin Weather Mod
$weather_url = "http://www.cwb.gov.tw/V5/forecast/taiwan/week.htm";
$area = array ("north", "middle", "south");
$north_contents = iconv("utf-8", "big5", "苗栗(.*)中部");
$middle_contents = iconv("utf-8", "big5", "嘉義(.*)台南");
$south_contents = iconv("utf-8", "big5", "屏東(.*)東北部");
$today_contents = iconv("utf-8", "big5", "第一直(.*)星期日");
$split_value = array (
"a" => "<td align=center valign=middle>",
"b" => "</td>",
"c" => "<BR>",
"d" => "<th align=center width=60 bgcolor=#f5f5f5>"
);
$fcontents = file_get_contents($weather_url);
for ($i = 0; $i <= count($area); $i++)
{
switch ($area[$i])
{
case "north" :
eregi($north_contents, $fcontents, $regs);
$north_split = explode("\n", $regs[1]);
$north_value = $north_split[1];
break;
case "middle" :
eregi($middle_contents, $fcontents, $regs);
$middle_split = explode("\n", $regs[1]);
$middle_value = $middle_split[1];
break;
case "south" :
eregi($south_contents, $fcontents, $regs);
$south_split = explode("\n", $regs[1]);
$south_value = $south_split[1];
break;
case "today" :
eregi($today_contents, $fcontents, $regs);
$today_split = explode("\n", $regs[1]);
$today_value = $today_split[2];
break;
}
}
for ($i = 0; $i <= count($split_value); $i++)
{
switch ($i)
{
case 0:
$north_value = str_replace($split_value['a'], "", $north_value);
$north_value = str_replace($split_value['b'], "", $north_value);
$north_value = str_replace("<img src=\"", "<img src=\"http://www.cwb.gov.tw/", $north_value);
$res = explode($split_value['c'], $north_value);
$north_weather = iconv("big5", "utf-8", $res[0]);
$north_temperature = iconv("big5", "utf-8", $res[1]);
break;
case 1:
$middle_value = str_replace($split_value['a'], "", $middle_value);
$middle_value = str_replace($split_value['b'], "", $middle_value);
$middle_value = str_replace("<img src=\"", "<img src=\"http://www.cwb.gov.tw/", $middle_value);
$res = explode($split_value['c'], $middle_value);
$middle_weather = iconv("big5", "utf-8", $res[0]);
$middle_temperature = iconv("big5", "utf-8", $res[1]);
break;
case 2:
$south_value = str_replace($split_value['a'], "", $south_value);
$south_value = str_replace($split_value['b'], "", $south_value);
$south_value = str_replace("<img src=\"", "<img src=\"http://www.cwb.gov.tw/", $south_value);
$res = explode($split_value['c'], $south_value);
$south_weather = iconv("big5", "utf-8", $res[0]);
$south_temperature = iconv("big5", "utf-8", $res[1]);
break;
case 3:
$today_value = str_replace($split_value['d'], "", $today_value);
$res = explode($split_value['c'], $today_value);
$today_date = iconv("big5", "utf-8", $res[0]);
break;
}
}
// End Weather Mod
#
#-----[ FIND 尋找 ]------------------------------------------------
#
'L_POSTED' => $lang['Posted'],
// End add - Photo Album Block
#
#-----[ AFTER, ADD 之後, 加上 ]------------------------------------
#
// Begin Weather Mod
'NORTH_WEATHER' => $north_weather,
'NORTH_TEMPERATURE' => $north_temperature,
'MIDDLE_WEATHER' => $middle_weather,
'MIDDLE_TEMPERATURE' => $middle_temperature,
'SOUTH_WEATHER' => $south_weather,
'SOUTH_TEMPERATURE' => $south_temperature,
'TODAY_DATE' => $today_date,
// End Weather Mod
#
#-----[ OPEN 打開 ]------------------------------------------------
#
portal_body.tpl
#
#-----[ FIND 尋找 ]------------------------------------------------
#
<!-- END switch_none_recentfiles -->
#
#-----[ AFTER, ADD 之後, 加上 ]------------------------------------
#
<!-- Begin Weather Mod-->
<table width="100%" cellpadding="3" cellspacing="1" border="0" class="forumline">
<tr>
<th colspan="3">{TODAY_DATE} 天氣預報</th>
</tr>
<tr>
<td class="row1" colspan="3" align="center">
<a href=http://news.pchome.com.tw/weather/cwb_data/s3p.jpg target="_new"><img src="http://news.pchome.com.tw/weather/cwb_data/s3p.jpg" width="120" height="132" board="0"></a>
</td>
</tr>
<tr>
<td class="row1" align="center">
<span class="gensmall">北部<br />
{NORTH_WEATHER}<br/>
{NORTH_TEMPERATURE}
</td>
<td class="row1" align="center">
<span class="gensmall">中部<br />
{MIDDLE_WEATHER}<br/>
{MIDDLE_TEMPERATURE}
</td>
<td class="row1" align="center">
<span class="gensmall">南部<br />
{SOUTH_WEATHER}<br/>
{SOUTH_TEMPERATURE}
</td>
</tr>
<tr>
<td class="row1" colspan="3" align="center">
<span class="gensmall">
<a href=http://www.cwb.gov.tw/V5/forecast/taiwan/week.htm target=_new>台灣各地1週天氣預報</a>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br />
<!-- End Weather Mod-->
#
#-----[ SAVE/CLOSE ALL FILES 儲存/關閉所有檔案 ]-------------------
#
# EoM