歡迎光臨, 訪客. 請先 登入註冊一個帳號.
三月 19, 2024, 06:33:36 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  核心補強精華區  |  分享小技巧~summary摘要的最新消息 « 上篇主題 下篇主題 »
頁: [1] 2
作者 主題: 分享小技巧~summary摘要的最新消息  (閱讀 47442 次)
hlps9999
LifeType 中文發展團隊
資深會員
*****
文章: 288



檢視個人資料 個人網站
« 於: 十一月 07, 2005, 03:07:41 下午 »

本校部落格的摘要頁,上面有個最新消息,當我認為有些消息要讓學校同仁知道時,就在那邊加上連結,那要改那個檔案呢?

就是 /plog/templates/ summary/recent.template

我在裡面加上了

引用
<table width="100%"  border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td bgcolor="#2FA2FF"><font color=#ffffff>最新消息</font></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">
☆11/07<a href="http://163.17.156.130/plog/post/2/337"> 文字編輯器改用TinyMCE,大家試試看,有問題再告訴我</a><br>
☆10/17<a href="http://163.17.156.130/plog/post/2/308"> 新增兩套模版,很漂亮唷!</a>
</td>
  </tr>
</table>

因為我都是使用「QuiXplorer檔案管理軟體」來線上修改檔案,所以也不會太麻煩。

不過,不知道有沒有辦法使用像「文章置頂及公告」這個plugin一樣,當在部落格裡發表一篇文章時,就直接在summary上顯示?假如可以,那就更方便了。
已記錄
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #1 於: 十一月 07, 2005, 03:40:33 下午 »

...............
因為我都是使用「QuiXplorer檔案管理軟體」來線上修改檔案,所以也不會太麻煩。

不過,不知道有沒有辦法使用像「文章置頂及公告」這個plugin一樣,當在部落格裡發表一篇文章時,就直接在summary上顯示?假如可以,那就更方便了。
宗欣兄:
試試 Mark 寫的 templateeditor plugin ,遇到修改模版要輸入中文時,就不會被 big5 和 utf-8 問題打敗了。而且支援直接修變 summary  模版的功能。

那個文章公告與置頂外掛是我 port 到 1.0 的,我再研究看看如何可以用在 summary 頁面。問題是時間……
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
ajer001
LifeType 中文發展團隊
超級會員
*****
文章: 516


張阿駕


檢視個人資料 個人網站
« 回覆文章 #2 於: 十一月 07, 2005, 06:48:28 下午 »

我用的方法也有點類似
不過忘了編輯方便
我自己新增了一個news.template的模板
然後用templateditor來作編輯
這樣就很方便了
已記錄

|| FreeBSD + Apache 2.x + PHP 5.x + MySQL 5.x ||
-- ajer001 AT twntwn.info --
hlps9999
LifeType 中文發展團隊
資深會員
*****
文章: 288



檢視個人資料 個人網站
« 回覆文章 #3 於: 十一月 07, 2005, 07:34:12 下午 »

宗欣兄:
試試 Mark 寫的 templateeditor plugin ,遇到修改模版要輸入中文時,就不會被 big5 和 utf-8 問題打敗了。而且支援直接修變 summary  模版的功能。

那個文章公告與置頂外掛是我 port 到 1.0 的,我再研究看看如何可以用在 summary 頁面。問題是時間……

修改模版時我是用 templateeditor plugin,只有要改summary或其他程式才用Quixplorer。

公告與置頂外掛如果能用在summary上,那就真的太方便了,最近中部(台中縣市、彰化縣)很多學校都正在開始使用LifeType。

lss加油!加油!

已記錄
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #4 於: 十一月 07, 2005, 07:47:34 下午 »

Hi hlps9999:

1. Template Editor 可以直接編輯 summary 模版
2. 你發了新的新聞,他當然會直接跑到 summary 的 recent post 阿!這是預設功能。如果你是希望能夠至頂,那得要自己改程式,或是自己改模版把新聞放到 summary 的頁面。

Mark
已記錄

lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #5 於: 十一月 07, 2005, 11:08:09 下午 »

宗欣兄的要求,我使用「土法鋉鋼術」做出庲了。

http://blog.nlhs.tyc.edu.tw/1 的「站務公告」裡的文章可以出現在 http://blog.nlhs.tyc.edu.tw/ summary 頁面裡了。請看一看效果如何?

目前的做法很粗糙,是直接在 class/summary/summarydefaultaction.class.php 裡面動手腳,而且也只能列出「所有」站務公告文章裡的連結。應該要能控制輸出數目及直接連到「站務公告」分類頁面的連結。還有,目前是把 blogId 和 CategoryId 寫死在 summarydefaultaction.class.php 裡面的,應該要能在管理介面設定比較好。

改到的地方如下,要用的請自便,完全測試用,不負任何保固責任,請事先備份以策安全。

紅色部份為加上/修改的地方:

class/summary/summarydefaultaction.class.php
特別注意
程式碼:
$announcePosts  = $articles->getBlogArticles( 1, -1, -1, 13);
這一行,參數為
程式碼:
$announcePosts  = $articles->getBlogArticles( 發佈公告的blogId, -1, -1, 放公告的CategoryId);
引用
<?php

    include_once( PLOG_CLASS_PATH."class/summary/action/summaryaction.class.php" );
    include_once( PLOG_CLASS_PATH."class/summary/dao/summarystats.class.php" );
    include_once( PLOG_CLASS_PATH."class/data/timestamp.class.php" );
    include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
    include_once( PLOG_CLASS_PATH."class/logger/LogUtil.php" );
    include_once( PLOG_CLASS_PATH."class/dao/articles.class.php" );

     /**
      * This is the one and only default action. It simply fetches all the most recent
      * posts from the database and shows them. The default locale is the one specified
      * in the configuration file and the amount of posts shown in this page is also
      * configurable through the config file.
      */
     class SummaryDefaultAction extends SummaryAction
     {

        var $_numPosts;

        function SummaryDefaultAction( $actionInfo, $request )
        {
            $this->SummaryAction( $actionInfo, $request );
            $this->_numPosts = $this->_config->getValue( "summary_page_show_max" );
        }

        /**
         * Loads the posts and shows them.
         */
        function perform()
        {
                        $this->_view = new SummaryCachedView( "index", Array( "summary" => "default", "locale" => $this->_locale->getLocaleCode()));
                        if( $this->_view->isCached()) {
                                // if the view is already cached... move along! nothing to see here
                                return true;
                        }

            $blogs       = new Blogs();
            $stats       = new SummaryStats();

            // load the posts, filtering out all those registration messages...
                        $registerTopic = $this->_locale->tr( "register_default_article_topic" );
                        $registerText = $this->_locale->tr( "register_default_article_text" );
            $recentPosts = $stats->getRecentArticles( $this->_numPosts, $registerTopic, $registerText );
            // get all the blogs
            $siteBlogs   = $blogs->getAllBlogs( true );
            $recentBlogs = $stats->getRecentBlogs( $this->_numPosts );

            $activeBlogs    = $stats->getMostActiveBlogs( $this->_numPosts);
            $commentedPosts = $stats->getMostCommentedArticles( $this->_numPosts, $registerTopic, $registerText );
            $readestBlogs   = $stats->getMostReadArticles( $this->_numPosts, $registerTopic, $registerText );
            $articles       = new Articles();
            $announcePosts  = $articles->getBlogArticles( 1, -1, -1, 13);


                        // export all these things to the view
                        $this->_view->setValue( "posts", $recentPosts );
                        $this->_view->setValue( "recentBlogs", $recentBlogs );
                        $this->_view->setValue( "activeBlogs", $activeBlogs );
                        $this->_view->setValue( "commentedPosts", $commentedPosts );
                        $this->_view->setValue( "readestBlogs", $readestBlogs );
                        $this->_view->setValue( "blogs", $siteBlogs );
                        $this->_view->setValue( "announces", $announcePosts );

                        //
                        // :KLUDGE:
                        // we just need a random blog so... we'll get one 微笑
                        //
                        $randomBlog = array_pop($siteBlogs);
                        $url = $randomBlog->getBlogRequestGenerator();
                        $this->_view->setValue( "url", $url );

                        $this->setCommonData();


            return true;
        }
     }
?>

templates/summary/announces.template
這個是新增的樣版檔,請自行修改得好看一點,然後分享給我,謝謝!
引用
<div id="intro">
<h4>blog 站務公告</h4>
{foreach from=$announces item=announce}
{assign var="blog" value=$announce->getBlogInfo()}
{assign var="url" value=$blog->getBlogRequestGenerator()}
<div class="subtitle">
<a href="{$url->postPermalink($announce)}">{$announce->getTopic()}</a>
</div>
{/foreach}
</div>

templates/summary/index.template
這裡要加入上面的 announces.template 樣版,加入紅色那一行
引用
.....
column-left部份省略
.....
<div id="maincolumn">
<div id="intro">
<h4>{$locale->tr("summary_welcome")}</h4>
歡迎來到內壢高中 blog 站!<br />
本站目前正在測試中,暫不開放註冊!本校同仁若有興趣參與測試,請洽資訊媒體組。
</div>
{include file="summary/announces.template"}
{include file="summary/recent.template"}
</div>
.....
column-right部份省略
.....

我空我再看看能不能把程式搞漂亮一點。
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #6 於: 十一月 07, 2005, 11:20:28 下午 »

lss 親自下海了,這一篇我得改到精華區去了  開懷大笑

呵呵!

Mark
已記錄

lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #7 於: 十一月 07, 2005, 11:26:11 下午 »

Mark:

我自己用得到的東西,做起來就比較快 微笑 微笑

倒是那個 announces.template 模版請有心人士改漂亮一點 吐舌頭 吐舌頭

倒是這個東西真的對 bloghosting 的管理員很實用,能不能加入 1.1 的 roadmap ?

我明天去 mantis 開個 feature issue 好了。
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
hlps9999
LifeType 中文發展團隊
資深會員
*****
文章: 288



檢視個人資料 個人網站
« 回覆文章 #8 於: 十一月 08, 2005, 12:32:06 上午 »

太棒了,太感謝lss了,就是想要有這樣的功能,剛剛立刻試了,但有幾個問題:

1.summarydefaultaction.class.php那檔案我這邊是在 /class/summary/action下面,而不是在/class/summay下
2.因為我要公告的網誌ID為2,但若我是用簡潔網址,那公告還是會跑到ID 1,若改成一般網址就沒這問題
3.已刪除的文章,還是會出現,當然點選後會出現「錯誤,找不到您所指定的文章」

這是我目前遇到的問題

(我先暫時把這修改拿掉,恢復簡潔網址,免得明早有老師跑來找我...)


另外請教,為何我的Template Editor(Release Date: 2005/03/19,Version: 1.1) 無法直接編輯 summary 模版,是版本不對還是要改什麼地方呢?
已記錄
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #9 於: 十一月 08, 2005, 07:24:27 上午 »

太棒了,太感謝lss了,就是想要有這樣的功能,剛剛立刻試了,但有幾個問題:

1.summarydefaultaction.class.php那檔案我這邊是在 /class/summary/action下面,而不是在/class/summay下
2.因為我要公告的網誌ID為2,但若我是用簡潔網址,那公告還是會跑到ID 1,若改成一般網址就沒這問題
3.已刪除的文章,還是會出現,當然點選後會出現「錯誤,找不到您所指定的文章」

這是我目前遇到的問題

(我先暫時把這修改拿掉,恢復簡潔網址,免得明早有老師跑來找我...)


另外請教,為何我的Template Editor(Release Date: 2005/03/19,Version: 1.1) 無法直接編輯 summary 模版,是版本不對還是要改什麼地方呢?
1.路徑錯誤,請原諒我當時已經神智不清貼錯了 吐舌頭
2.我試過沒問題,我也是用簡潔網址。請試試把 tmp/summary/* 刪掉後再重整網頁,大概為了效能原因,summary 被做了內容的 cache。
3.把
程式碼:
$announcePosts  = $articles->getBlogArticles( 發佈公告的blogId, -1, -1, 放公告的CategoryId);
改成$announcePosts  = $articles->getBlogArticles( 發佈公告的blogId, POST_STATUS_PUBLISHED, -1, 放公告的CategoryId);
程式碼:
$announcePosts  = $articles->getBlogArticles( 發佈公告的blogId, -1, -1, 放公告的CategoryId, POST_STATUS_PUBLISHED);
應該就可以了。

這個可以參考 api 文件: http://lifetype.org.tw/api/d3/db7/classArticles.html#a8
« 最後編輯時間: 十一月 08, 2005, 10:57:00 上午 由 lss » 已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #10 於: 十一月 08, 2005, 07:45:43 上午 »

另外請教,為何我的Template Editor(Release Date: 2005/03/19,Version: 1.1) 無法直接編輯 summary 模版,是版本不對還是要改什麼地方呢?
template editor 請更新版本至 2005/05/xx 的版本,直接到 sourceforge.net 下載就行了。
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
hlps9999
LifeType 中文發展團隊
資深會員
*****
文章: 288



檢視個人資料 個人網站
« 回覆文章 #11 於: 十一月 08, 2005, 10:46:06 上午 »

感謝喔!  吐舌頭

2.簡潔網址的確是因為cache的關係,已OK。
3.我若將-1 改成 POST_STATUS_PUBLISHED ,反而看不到任何公告了,所以我又改成-1。
 若有刪除了的公告,我必須到「全部站台管控」/「清理垃圾」/「清理文章」之後,再將 /tmp/summary清空,才不會看見那已被刪除的文章。

那個announces.template,我目前的設定是這樣 http://plog.hlps.tcc.edu.tw/plog/
程式碼:
<table width="100%"  border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td bgcolor="#2FA2FF"><font color=#ffffff>最新消息</font></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF">
{foreach from=$announces item=announce}
{assign var="blog" value=$announce->getBlogInfo()}
{assign var="url" value=$blog->getBlogRequestGenerator()}
  <div class="mycsspost">
 ☆ <a href="{$url->postPermalink($announce)}">{$announce->getTopic()}</a>
  </div>
{/foreach}
    </td>
  </tr>
</table>

在/styles/summary.css我看不到有subtitle這個設定,為了我自己的版面顏色,新增了一個 .mycsspost

程式碼:
.mycsspost a:link {
color: #5F8F00;
text-decoration: none;
}
.mycsspost a:visited {
color: #5F8F00;
text-decoration: none;
}
.mycsspost a:hover {
color: #92DB00;
text-decoration: underline;
}


至於Template Editor的問題,因為之前是到 Open Foundry下載,改去 SourceForge下載就OK了。
« 最後編輯時間: 十一月 08, 2005, 10:58:08 上午 由 hlps9999 » 已記錄
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #12 於: 十一月 08, 2005, 11:04:26 上午 »

引用
3.我若將-1 改成 POST_STATUS_PUBLISHED ,反而看不到任何公告了,所以我又改成-1。
夭壽哦!睡眠不足真的不能亂 po 文,真是對不起。已於原 po 更正了。
引用
若有刪除了的公告,我必須到「全部站台管控」/「清理垃圾」/「清理文章」之後,再將 /tmp/summary清空,才不會看見那已被刪除的文章。
從程式碼裡看到的,summary 頁面的 cache 時間為一天,一天後應該就會自動更新了。
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #13 於: 十一月 08, 2005, 11:06:19 上午 »

對了,改寫ing.....
先通知一下  微笑
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
hlps9999
LifeType 中文發展團隊
資深會員
*****
文章: 288



檢視個人資料 個人網站
« 回覆文章 #14 於: 十一月 08, 2005, 11:35:08 上午 »

 :-P了解

期待ing...
已記錄
頁: [1] 2
LifeType 中文開發論壇  |  開發  |  核心補強  |  核心補強精華區  |  分享小技巧~summary摘要的最新消息 « 上篇主題 下篇主題 »
    前往: