列出文章
|
頁: [1]
|
1
|
支援 / 安裝與設定精華區 / Re: plog首页(index.php?blogId=X)文章分页处理问题?焦急?
|
於: 十二月 07, 2005, 03:26:09 下午
|
感谢maomaode的帮助,论坛需要你这样的好人!再次感谢!
特此把方法贴出来方便大家: 1. 在main.template 加如下代码: {if !$showAll} <div class="pager"> {include file="$blogtemplate/../summary/pager.template" style=links} </div> {/if} 大功告成! 2.打开paper.template(找不到就用搜索找找 一概在plog/templates/summary/pager.template)该一下CSS定义,这里只是该 “前一页 1.2.3.下一页“的位置,这个要根据你的模板的样式来自行更改
再一次谢谢maomaode 和markwu的热心回帖!谢谢!
|
|
|
4
|
支援 / 安裝與設定 / 请教 ajer001 大大!
|
於: 十二月 05, 2005, 09:56:11 上午
|
小弟拜访了您的blog, 受益匪浅,尤其是对 “熱門文章 ” 和“ 部落格資料 ” 特别崇拜 ,不知张大哥可不可以赐教一二或给个思路该怎样做?真的谢谢您! ------------------------- 熱門文章 ------------------------- ------------------------- 文章總數: 站上人數: 累積訪客: -------------------------
|
|
|
5
|
支援 / 安裝與設定精華區 / plog首页(index.php?blogId=X)文章分页处理问题?焦急?
|
於: 十二月 05, 2005, 09:44:45 上午
|
等了几天了,没办法只好再发个帖了,请大大原谅 (原贴:http://forum.lifetype.org.tw/index.php?topic=1372.new;topicseen#new) 前几天拜读了ffsword 的首页分类法 于是就依葫芦画瓢, 直接拷贝这段Code: <?php
include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" ); include_once( PLOG_CLASS_PATH."class/view/defaultview.class.php" ); include_once( PLOG_CLASS_PATH."class/net/http/session/sessioninfo.class.php" ); include_once( PLOG_CLASS_PATH."class/dao/blogs.class.php" ); include_once( PLOG_CLASS_PATH."class/view/errorview.class.php" ); include_once( PLOG_CLASS_PATH."class/view/view.class.php" ); include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" ); include_once( PLOG_CLASS_PATH."class/data/pager/pager.class.php" );
/** * \ingroup Action * @private * * This class represents the defaut view in our application */ class DefaultAction extends BlogAction {
var $_config; var $_date; var $_categoryId; var $_categoryName; var $_userId; var $_userName; var $_postAmount; var $_page; //add by FFS
function DefaultAction( $actionInfo, $request ) { $this->BlogAction( $actionInfo, $request ); // add by FFS (for show page) //$this->_page = view::getCurrentPageFromRequest(); if ($_REQUEST["page"]=="") $this->_page = 1; else $this->_page = $_REQUEST["page"]; }
function validate() { // value of the Date parameter from the request $this->_date = $this->_request->getValue( "Date", -1 );
$this->_categoryName = $this->_request->getValue( 'postCategoryName' ); $this->_categoryId = $this->_request->getValue( 'postCategoryId' ); /* if( $this->_categoryId == '' ) if( $this->_date == -1 ) $this->_categoryId = 0; else $this->_categoryId = -1; */ // **** add **** if( $this->_categoryId == '' ) $this->_categoryId = -1; // **** end *** $this->_userId = $this->_request->getValue( 'userId', -1 ); $this->_userName = $this->_request->getValue( 'userName' );
return true; }
/** * Executes the action */ function perform() { // first of all, we have to determine which blog we would like to see $blogId = $this->_blogInfo->getId();
// fetch the settings for that blog $blogSettings = $this->_blogInfo->getSettings();
// prepare the view $this->_view = new DefaultView( $this->_blogInfo, Array( "categoryId" => $this->_categoryId, "blogId" => $this->_blogInfo->getId(), "categoryName" => $this->_categoryName, "date" => $this->_date, "userName" => $this->_userName, "userId" => $this->_userId )); // check if everything's cached because if it is, then we don't have to // do any work... it's already been done before and we should "safely" assume // that there hasn't been any change so far if( $this->_view->isCached()) { return true; }
// if we got a category name instead of a category id, then we // should first look up this category in the database and see if // it exists $categories = new ArticleCategories(); if( $this->_categoryName ) { $category = $categories->getCategoryByName( $this->_categoryName, $this->_blogInfo->getId()); if( !$category ) { $this->_view = new ErrorView( $this->_blogInfo ); $this->_view->setValue( 'message', "error_incorrect_category_id" ); $this->setCommonData(); return false; } // if everything went fine... $this->_categoryId = $category->getId(); } else { // we don't do anything if the cateogry id is '0' or '-1' if( $this->_categoryId > 0 ) { $category = $categories->getCategory( $this->_categoryId, $this->_blogInfo->getId()); if( !$category ) { $this->_view = new ErrorView( $this->_blogInfo ); $this->_view->setValue( 'message', "error_incorrect_category_id" ); $this->setCommonData(); return false; } } } // export the category object in case it is needed if( isset($category) ) $this->_view->setValue( "category", $category );
$users = new Users();
// if we got a user user id, then we should first look up this id // user in the database and see if it exists if( $this->_userId > 0) { $user = $users->getUserInfoFromId( $this->_userName ); if( !$user ) { $this->_view = new ErrorView( $this->_blogInfo ); $this->_view->setValue( 'message', 'error_incorrect_user_id' ); $this->setCommonData(); return false; } }
// if we got a user name instead of a user id, then we // should first look up this user in the database and see if // it exists if( $this->_userName ) { $user = $users->getUserInfoFromUsername( $this->_userName ); if( !$user ) { $this->_view = new ErrorView( $this->_blogInfo ); $this->_view->setValue( 'message', 'error_incorrect_user_id' ); $this->setCommonData(); return false; } // if everything went fine... $this->_userId = $user->getId(); }
// export the owner. The owner information should get from blogInfo directly $this->_view->setValue( "owner", $this->_blogInfo->getOwnerInfo() ); $t = new Timestamp(); $todayTimestamp = $t->getTimestamp(); // amount of posts that we have to show, but keeping in mind that when browsing a // category or specific date, we should show *all* of them /* if( $this->_date > 0 || $this->_categoryId > 0 ) { $this->_postAmount = -1; // also, inform the template that we're showing them all! $this->_view->setValue( 'showAll', true ); } else { */ $this->_postAmount = $blogSettings->getValue( 'show_posts_max' ); $this->_view->setValue( 'showAll', false ); /* } */ // // :KLUDGE: // the more things we add here to filter, the more complicated this function // gets... look at this call and look at how many parameters it needs!! // if( ($blogSettings->getValue( 'show_future_posts_in_calendar')) && ( $this->_date > -1 )) { // if posts in the future are to be shown, we shouldn't set a maximum date $blogArticles = $this->articles->getBlogArticles( $blogId, $this->_date, $this->_postAmount, $this->_categoryId, POST_STATUS_PUBLISHED, $this->_userId , 0, // no maxdate '', // current search terms $this->_page); $numPosts = $this->articles->getNumBlogArticles( $blogId, $this->_date, $this->_postAmount, $this->_categoryId, POST_STATUS_PUBLISHED, $this->_userId , 0, // no maxdate '', // current search terms $this->_page); } else { $blogArticles = $this->articles->getBlogArticles( $blogId, $this->_date, $this->_postAmount, $this->_categoryId, POST_STATUS_PUBLISHED, $this->_userId, $todayTimestamp, '', // current search terms $this->_page ); $numPosts = $this->articles->getNumBlogArticles( $blogId, $this->_date, $this->_postAmount, $this->_categoryId, POST_STATUS_PUBLISHED, $this->_userId, $todayTimestamp, '', // current search terms $this->_page ); }
// if we couldn't fetch the articles, send an error and quit if( count($blogArticles) == 0 ) { $this->_view = new ErrorView( $this->_blogInfo ); $this->_view->setValue( 'message', 'error_fetching_articles' ); } else { // otherwise, continue // the view will take care of cutting the post if we have the "show more" // feature enabled or not... we could do it here but I think that belongs // to the view since it is presentation stuff... It could also be handled // by the template but then it'd make the template a little bit more // complicated... // --- // before finishing, let's see if there's any plugin that would like to do // anything with the post that we just loaded // --- $pm =& PluginManager::getPluginManager(); $pm->setBlogInfo( $this->_blogInfo ); $pm->setUserInfo( $this->_userInfo ); $result = $pm->notifyEvent( EVENT_POSTS_LOADED, Array( 'articles' => &$blogArticles )); $articles = Array(); foreach( $blogArticles as $article ) { $postText = $article->getIntroText(); $postExtendedText = $article->getExtendedText(); $pm->notifyEvent( EVENT_TEXT_FILTER, Array( "text" => &$postText )); $pm->notifyEvent( EVENT_TEXT_FILTER, Array( "text" => &$postExtendedText )); $article->setIntroText( $postText ); $article->setExtendedText( $postExtendedText ); array_push( $articles, $article ); } // add by FFS (for show page) $blog = $this->_blogInfo; $blog_id = $blog->getId(); $pager = new Pager( "?blogId=".$blog_id."&page=", $this->_page, $numPosts, $this->_postAmount ); $this->_view->setValue( 'pager', $pager ); $this->_view->setValue( 'posts', $articles ); }
$this->setCommonData(); // save the information about the session for later $this->saveSession();
return true; } } ?>
也改 管理设置=>全局设置=>模板设置 中的template_cache_enabled 设置为否
我上传了文件 defaultaction.class.php到 plog/class/action从开机, 在IE处还清cashed文件,template换了几个 但是 主页还是什么也没变超级不理解呀 :-(到底哪里错了呢??????我的首页: http://www.lastminder.com/plog/index.php?blogId=1子页(加分页显示) http://www.lastminder.com/plog/index.php?op=ViewArticle&articleId=20&blogId=1
|
|
|
10
|
支援 / 安裝與設定 / 請問一下關於顯示分類的描述
|
於: 十一月 26, 2005, 01:08:28 上午
|
查了两个贴子: http://forum.lifetype.org.tw/index.php?topic=445.0http://forum.lifetype.org.tw/index.php?topic=930.0也知道了 {$category->getDescription()} 但是当我加在 post.template 后 <!-- {$url->postTrackbackLink($post)} --> {assign var="postDate" value=$post->getDateObject()} {assign var="postOwner" value=$post->getUserInfo()} <!-- post start --> <div class="post-title"> <em> [{foreach name=categories from=$post->getCategories() item=postcategory} <a href="{$url->categoryLink($postcategory)}">{$postcategory->getName()}</a> {if !$smarty.foreach.categories.last}, {/if} {/foreach}] </em> {$locale->formatDate($postDate,"%d %B, %Y %H:%M")}</br> {$category->getDescription()} </div> <p class="post-info"><a href="{$url->postPermalink($post)}" rel="bookmark" title="Permanent Link: {$post->getTopic()}"> {$post->getTopic()} </a></p> <div class="post-content">{$post->getText()}</div> <div class="post-footer"><span class='link-comment'>[<a href="{$url->postPermalink($post)}"> ({$post->getTotalComments()}) {$locale->tr("comment on this")} </a>]</span> | [<a href="{$url->postTrackbackStatsLink($post)}"> ({$post->getNumTrackbacks()}) {$locale->tr("trackbacks")} </a>] | [<a href="{$url->postPermalink($post)}">{$locale->tr("permalink")}</a>] | [ {$post->getNumReads()} Readers ]</div> 得到这个错误i信息: Fatal error: Call to a member function on a non-object in /usr/local/psa/home/vhosts/lastminder.com/httpdocs/plog/tmp/1/%%-14^%%-1489170800^post.template.php on line 28 各位高手有没有什么想法请指点一二!!! 我用的是网上的hosting comapny到现在没有什么安装错误,plog 1.0 上个星期下载的!
|
|
|
|
|
|