歡迎光臨, 訪客. 請先 登入註冊一個帳號.
三月 19, 2024, 04:36:41 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  核心補強精華區  |  點選"閱讀全文"時focus在延伸內文那一部份 « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 點選"閱讀全文"時focus在延伸內文那一部份  (閱讀 14931 次)
ericj
新手見習
*
文章: 43



檢視個人資料 個人網站
« 於: 十月 01, 2005, 02:10:25 下午 »

修改  class/view/defaultview.class.php

程式碼:
function _addShowMoreLink()
{
    $posts = $this->_params->getValue( 'posts' );
    $locale = $this->_blogInfo->getLocale();

    //$textFilter = new TextFilter();
    $modifPosts = Array();
    $rg = RequestGenerator::getRequestGenerator( $this->_blogInfo );
    foreach( $posts as $post ) {
    if( $post->hasExtendedText()) {
          $result = $post->getIntroText();
          $showMoreText = $locale->tr( 'read_more' );
+         // patch for read more text focus by ericj.
!         $showMoreLink = "&nbsp;<a href=\"".$rg->postPermalink($post)."#More\">".$showMoreText."</a>";
          $post->setText( $result. $showMoreLink );
    }

    array_push( $modifPosts, $post );
}


view/viewarticleview.class.php

程式碼:
function render()
{
    // if our view is cached, there is not much to do here...
    if( $this->isCached()) {
    parent::render();
    return true;
    }

    // get the next and previous articles, based on the article we're going to show
    $article = $this->getValue( 'post' );

    // notify of certain events
    $postText = $article->getIntroText();

+   // patch for focus by ericj
!   $postExtendedText = "<a name="."\"More\"></a>".$article->getExtendedText();

    #$postExtendedText = $article->getExtendedText();
    $this->_pm->notifyEvent( EVENT_TEXT_FILTER, Array( 'text' => &$postText ));
    $this->_pm->notifyEvent( EVENT_TEXT_FILTER, Array( 'text' => &$postExtendedText ));
    $article->setIntroText( $postText );
    $article->setExtendedText( $postExtendedText );
    // and yet one event more
    $this->_pm->notifyEvent( EVENT_POST_LOADED, Array( 'article' => &$article ));

    // once ready, put the article back to the context of the view
    $this->setValue( 'post', $article );
    $this->setValue( 'comments', $article->getComments());
    $this->setValue( 'user', $article->getUser());
    $this->setValue( 'trackbacks', $article->getTrackbacks());

    // render the main view
    parent::render();
}

« 最後編輯時間: 十月 03, 2005, 09:33:13 下午 由 ericj » 已記錄

Pentium4 1.5GHz + 512MB SDRAM + 200G vinum mirror RAID
FreeBSD6.1+lighttpd+php5-cgi+MySQL5.1
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #1 於: 十月 03, 2005, 01:38:19 下午 »

Hi ericj:

謝謝!我把他移到精華區中。 開懷大笑

Mark
已記錄

頁: [1]
LifeType 中文開發論壇  |  開發  |  核心補強  |  核心補強精華區  |  點選"閱讀全文"時focus在延伸內文那一部份 « 上篇主題 下篇主題 »
    前往: