歡迎光臨, 訪客. 請先 登入註冊一個帳號.
四月 23, 2024, 11:37:05 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  请教在summary模板中添加单独的博客排名页面... « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 请教在summary模板中添加单独的博客排名页面...  (閱讀 16718 次)
yufeng
新手見習
*
文章: 39


檢視個人資料
« 於: 三月 10, 2006, 08:45:54 下午 »

我想把summary页面的"最活跃的博客" "评论最多的文章" 和"阅读最多的文章" 这几个排名的内容单独作成几个页面, 在summany的首页点击链接就可以看到这些单独的排名了,比如 "最活跃的博客 Top20" 这样子的...

我试着用faq.template来修改,copy了summany中相应的一些代码, 但是 用 ?op=display&page=faq.template来访问却是没有任何的结果显示出来, 请教各位如何能简便地实现这个功能呢...谢谢 開懷大笑
已記錄

服务器环境:
LINUX RH ES3/PHP 4.4.0/MySQL 4.1.11/Apache 2.0.54
======================
调试环境:
Win2003/PHP 4.4.1/MySQL 4.1.11/Apache 2.0.54
lss
我不是被~拉~~出來的,不要叫我大大!
總版主
超級會員
*****
文章: 1511



檢視個人資料 個人網站
« 回覆文章 #1 於: 三月 10, 2006, 09:18:38 下午 »

...
我试着用faq.template来修改,copy了summany中相应的一些代码, 但是 用 ?op=display&page=faq.template来访问却是没有任何的结果显示出来, 请教各位如何能简便地实现这个功能呢...谢谢 開懷大笑
summary 的自訂頁面是不帶 summary 首頁裡的那些物件的,你必需比照 summarydefaultaction.class.php 替這些自訂頁面寫相對應的程式,並且以 op={action} 的方式開啟頁面才行。基本上,你也可以試試用「抄」的方式來抄 summarydefaultaction.class.php ,然後在模版的部份另外寫成你想要的模樣。

mmm... 你得先從研究 /summary.php 和 /class/summary/action/summarydefaultaction.class.php 開始。你有興趣的話,歡迎一起研究。

lss
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
yufeng
新手見習
*
文章: 39


檢視個人資料
« 回覆文章 #2 於: 三月 12, 2006, 08:42:37 下午 »

谢谢lss的建议, 最近比较忙, 有空了就按照这个研究研究, 有什么成绩会和大家分享的...呵呵... 開懷大笑
已記錄

服务器环境:
LINUX RH ES3/PHP 4.4.0/MySQL 4.1.11/Apache 2.0.54
======================
调试环境:
Win2003/PHP 4.4.1/MySQL 4.1.11/Apache 2.0.54
jikey
新手見習
*
文章: 6


檢視個人資料
« 回覆文章 #3 於: 七月 12, 2006, 10:13:47 下午 »

我做到....!
打開 /class/summary/action/summarycustompageaction.class.php

in /class/summary/action/summarycustompageaction.class.php

find
程式碼:
include_once( PLOG_CLASS_PATH."class/summary/data/validator/customsummarypagevalidator.class.php" );

after paste
 
程式碼:
  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" );
find
程式碼:
$this->_view = new SummaryCachedView( $this->_page, Array( "page" => $this->_page, "locale" => $this->_locale->getLocaleCode()));
 

after paste

程式碼:
	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 );


// 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 );


//
// :KLUDGE:
// we just need a random blog so... we'll get one :)
//
$randomBlog = array_pop($siteBlogs);
$url = $randomBlog->getBlogRequestGenerator();
$this->_view->setValue( "url", $url );
已記錄
jikey
新手見習
*
文章: 6


檢視個人資料
« 回覆文章 #4 於: 七月 13, 2006, 12:02:56 上午 »

可是上傳了服務器就會面對cache的問題.....o...

不知道如何刪除掉/tmp 里的files?
已記錄
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #5 於: 七月 13, 2006, 09:01:58 上午 »

你必須手動刪除,或是發表一篇新聞張,讓 cache 自動刪除,或是等待你的 summary cache time out。

我建議手動刪除比較快。

Mark
已記錄

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



檢視個人資料 個人網站
« 回覆文章 #6 於: 七月 13, 2006, 11:45:45 上午 »

hi jikey:

good job  微笑

再給你提供另一個方向。你這樣做,對每個 summary 的自訂頁面都提供了所有 summary 主頁的樣版物件,如果網站的 blog 多起來了,對效能影響較大。

你可以另外做一個專用的 action 和 view 只提供需要的物件,會更好一點。

lss
已記錄

沒找過 常見問題集或不知道 如何在 LifeType 中文開發論壇發問的人,恕不回答問題
jikey
新手見習
*
文章: 6


檢視個人資料
« 回覆文章 #7 於: 七月 14, 2006, 06:24:17 上午 »

hi mark
不知道為身麼我的服務器不允許我自己手動刪除...... ~~~

只是那個/tmp 而已... 我使用linux - directadmin 的.

hi lss,
謝謝你給的tips!不過要如何修改的更好我不是很會~
我只是迷迷糊糊的嘗試而已... 微笑 希望你可以提供更多的tips

謝謝
jikey
已記錄
頁: [1]
LifeType 中文開發論壇  |  開發  |  核心補強  |  请教在summary模板中添加单独的博客排名页面... « 上篇主題 下篇主題 »
    前往: