六月 04, 2007
[架設技術]新生部落格升級1.1→1.2.1版
1.備份資料庫及資料。
2.將lifetype 1.2.1 複進到系統資料夾中,取代原有檔案。
3.修改config/config.properties.php 內容及讀取權限
4.執行wizard.php (瀏覽器)
新生部落格特有功能及函數修改:
(一)修改 /class/summary/dao/summarystatus.class.php
1.getRecentPicture() 最近上傳的圖片檔案
------------程式--------------
/**
* gets all links in the first blog(blogid=1)
* write by cmchuang in Taipei SNES
* 2006.02.28
*/
function getRecentPicture( )
{
include_once( PLOG_CLASS_PATH."class/gallery/dao/galleryresources.class.php" );
$query = "SELECT * from ".$this->getPrefix()."gallery_resources where resource_type = '".GALLERY_RESOURCE_IMAGE."' order by date DESC LIMIT 0, 12";
$result = $this->Execute( $query );
$recentresources = Array();
$resources = new GalleryResources();
if( !$result ){
return Array();
}
while( $row = $result->FetchRow()) {
$recentresource = $resources->mapRow($row);
array_push( $recentresources, $recentresource );
}
$result->Close();
return $recentresources;
}
--------------------------------------------------------------
2.getRecentAnnounce() 最近公告文章(讀取第一個部落格的第一個類別文章)
-----程式------------
/**
* gets all announce article in the first blog (blogid=1 category=1)
* write by cmchuang at Taipei SNES
*/
function getRecentAnnounce( )
{
include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );
$query = "select ".$this->getPrefix()."articles.* from ".$this->getPrefix()."article_categories_link left join ".$this->getPrefix()."articles on (".$this->getPrefix()."article_categories_link.article_id = ".$this->getPrefix()."articles.id) where ".$this->getPrefix()."article_categories_link.category_id = 1 ORDER BY ".$this->getPrefix()."articles.date DESC LIMIT 0, 2";
$result = $this->Execute( $query );
$blogs = Array();
$posts = Array();
$articles = new Articles();
if( !$result ){
return Array();
}
while( $row = $result->FetchRow()) {
$post = $articles->mapRow($row);
array_push( $posts, $post );
}
$result->Close();
return $posts;
}
-----------------------------------------------------------
3.getViewedTotal()總瀏覽數
-------程式------------------------------------------------
function getViewedTotal()
{
$query = "SELECT SUM(num_reads) as total FROM ".$this->getPrefix()."articles WHERE blog_id >=0";
$result = $this->Execute( $query );
if (!$result)
return false;
$row = $result->FetchRow();
if (!isset($row["total"]))
return 0;
$result->close();
return $row["total"];
}
---------------------------------------------------------------
4.getTotalPosts() 文章總數
---------------程式------------------
/** write by cmchuang in Taipei SNES
* Retrieves the total number of posts in all blogs
*
* @param blogId The identifier of the blog from which we'd like to fetch the settings
* @return Returns an integer with the number of posts
*/
function getTotalPosts()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."articles WHERE blog_id >=0 AND status = ".POST_STATUS_PUBLISHED;
$result = $this->Execute( $query );
if (!$result)
return false;
$row = $result->FetchRow();
if (!isset($row["total"]))
return false;
$posts = intval($row["total"]);
$result->Close();
return( $posts );
}
----------------------------------------------------
5.getNumofBlogs()網誌總數
----------------------------程式-----------------
/* gets number of blogs in this Suite .. Writen by CMchuang in SNES */
function getNumofBlogs()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."blogs WHERE status = ".BLOG_STATUS_ACTIVE;
$result = $this->Execute( $query );
if (!$result)
return false;
$row = $result->FetchRow();
if (!isset($row["total"]))
return false;
$posts = intval($row["total"]);
$result->Close();
return( $posts );
}
---------------------------------------------------
6.getNumofComments() 迴響總數
-----------------------------程式-----------------------
/* gets number of Comments in this Suite .. Writen by CMchuang in SNES */
function getNumofComments()
{
$query = "SELECT COUNT(*) as total FROM ".$this->getPrefix()."articles_comments WHERE status = ".COMMENT_STATUS_NONSPAM;
$result = $this->Execute( $query );
if (!$result)
return false;
$row = $result->FetchRow();
if (!isset($row["total"]))
return false;
$posts = intval($row["total"]);
$result->Close();
return( $posts );
}
-------------------------------------------------------
(二)修改/class/dao/ bloginfo.class.php
1.getViewedTotal() 網誌總瀏覽數
--------程式---------
/* getViewedTotal
Writen by Cmchuang in SNES 2006.09.10
*/
function getViewedTotal()
{
include_once( PLOG_CLASS_PATH."class/dao/model.class.php" );
$db = new Model();
$query = "SELECT SUM(num_reads) as total FROM ".$db->getPrefix()."articles WHERE blog_id =".$this->getId();
$result = $db->Execute( $query );
if (!$result)
return false;
$row = $result->FetchRow();
if (!isset($row["total"]))
return 0;
$result->close();
return $row["total"];
}
----------------------------------------------------
<script type="text/javascript" src="http://blog.snes.tp.edu.tw/js/lightbox/js/scriptaculous.js?load=effects"></script>
<script type="text/javascript" src="http://blog.snes.tp.edu.tw/js/lightbox/js/lightbox.js"></script>
<link rel="stylesheet" href="http://blog.snes.tp.edu.tw/js/lightbox/css/lightbox.css" type="text/css" media="screen" />
{
var htmlCode = '';
if( targetLink != '' ) {
htmlCode = '<a id="res_'+resourceId+ '" rel="lightbox[roadtrip]" title="'+resourceDesc+'" href="'+targetLink+'" type="'+resourceMimeType+'">';
htmlCode += '<img style="margin: 5px;" border="0" alt="'+resourceDesc+'" src="'+resourceLink+'" />';^M
htmlCode += '</a>';
}
------------------------------------------------------------------
回應文章
http://謝謝!

http://在summary模版裡加上…
在summary模版中適當的位置加上…{$summaryStats->getViewedTotal()}

Re: [架設技術]新生部落格升級1.1→1.2.1版
請問如何呼叫總瀏覽數@@?

http://好像沒有找到…
為了回答湘坪老師的問題,找了許久,結果沒有找到悄悄話迴響,反而找到secret blog的功能,必須輸入瀏覽密碼才能看到整個部落格…
功能介紹等我整理好 ,就編輯教學文件囉…

http://我想要悄悄話
小明老師:
好久沒來打擾了,請問部落格的迴響是否可設定悄悄話呢?

我也不知!
某天,一打開要變這樣了。
完全沒更動原來的檔,
也沒有更新。

呵呵…
兩列的企鵝…很特別啊…
是更新後造成的嗎?
還是改了CSS的設定?

頭好大!
看了您的複製流程,腦袋開始脹大了,
對於只會應用的我,這真是太複雜了!
而且,我的企鵝部落格的「頭」也「脹」大了!不知道為什麼變成兩列?
救命呀!老師!

已完成新設定了…
sorry!!
湘坪老師,我檢查了一下,原來系統更新後,系統管理員可以做每個網誌迴響顯示數目的設定,目前已經把上限設為500,若還是不足,請再通知我調整。
您快速的反應,讓我們很快就找到問題,感謝您囉!!
另外,升級的動作是由系統這邊做的,那些步驟是我寫下來準備給一些對我們學校部落格首頁有興趣的外校老師參考及做為個人的技術資料庫用,請大家幫忙回報操作問題即可,謝謝!!

我又來了
在網誌設定中修改後,迴響還是只能顯示50篇,其他的只有部落格的管理員看得到,要怎麼修改呢?

自言自語
原來要到網誌設定中修改,原始設定為20啦,對不起打擾了!

消失的迴響
我發現不管在哪裡,迴響都只剩20,天哪!我們有3百多篇的,都到哪裡去了?@~@

關於升級
親愛的小明老師,請問升級的步驟是各班部落格需要做的嗎?我們班的迴響怪怪的喔!84個迴響只剩下20個,是怎麼回事呢?

升級步驟誰做呢?
親愛的小明老師,請問升級的步驟是各班部落格需要做的嗎?我們班的迴響怪怪的喔!

謝謝小明老師!已經成功了!!