歡迎光臨, 訪客. 請先 登入註冊一個帳號.
五月 03, 2024, 07:42:31 下午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  核心補強  |  请教如何在summary中加入自己的内容? « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 请教如何在summary中加入自己的内容?  (閱讀 22500 次)
yufeng
新手見習
*
文章: 39


檢視個人資料
« 於: 十二月 24, 2005, 11:27:12 下午 »

已经在footer上面增加了诸如"隐私保护","关于我们"等链接, 希望用户点击这些链接在summary的maincolumn部份显示相应的内容, 这些文本内容可以和agreement.template一样的形式存在, 刚刚接触lifetype, 对整体还没有什么概念 害羞, 希望大家指点下,需要修改哪些地方,大概的思路是怎样的, 谢谢 開懷大笑
已記錄

服务器环境:
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
winman
LifeType 中文發展團隊
超級會員
*****
文章: 525


winman


檢視個人資料 個人網站
« 回覆文章 #1 於: 十二月 25, 2005, 01:10:39 上午 »

你的意思是点击下面的链接后,在maincolumn里会显示出点的那个链接里的内容吗?
如果是这样,我假设你懂css/javascript,比较简单的做法是利用css来控制layer的
显示/不显示。供参考。
已記錄

俗语说:授予鱼,不如授予渔。因此在发问前先搜寻论坛,或许困扰你
的问题,在之前已经有朋友遇到并得到解答了。这样不但提高解决问题
的效率,还能令自己的能力不断加强。加油啊。
yufeng
新手見習
*
文章: 39


檢視個人資料
« 回覆文章 #2 於: 十二月 26, 2005, 05:28:44 下午 »

谢谢winman的思路,功能已经基本实现了... 谢谢!

还有一个小问题, 就是需要调用js, 有些浏览器在处理js的时候会有问题...会导致该功能失效..呵呵...
« 最後編輯時間: 十二月 26, 2005, 09:00:00 下午 由 yufeng » 已記錄

服务器环境:
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
ajer001
LifeType 中文發展團隊
超級會員
*****
文章: 516


張阿駕


檢視個人資料 個人網站
« 回覆文章 #3 於: 十二月 27, 2005, 12:15:02 下午 »

還有一個辦法,是自己加上 .template 檔案
然後裡面寫上你要讓人知道的內容
例如我的站的教學區 http://blog.twntwn.info/summary.php?op=display&page=faq

自己寫一個 .template 檔案
格式要注意一下
可以參考看看 summary 下面的 faq.template 去改
然後在適當位置加上連結:
http://BLOG-URL/summary.php?op=display&page=模板名稱

不知道這可不可以達到你的要求
已記錄

|| FreeBSD + Apache 2.x + PHP 5.x + MySQL 5.x ||
-- ajer001 AT twntwn.info --
yufeng
新手見習
*
文章: 39


檢視個人資料
« 回覆文章 #4 於: 一月 07, 2006, 09:51:55 下午 »

刚才试验了一下 ajer001的方法, 我复制了一份 index.template ,重新命名为 infohelp.template,
使用 http://BLOG-URL/summary.php?op=display&page=infohelp 可以访问, 但是"最新开通的博客","最活跃的博客","评论最多的文章" ,"阅读最多的文章 "这些内容都没有了...

请问有没有办法和 index.template一样呢? 只是中间的maincolumn部份替换我自己的内容...谢谢!
已記錄

服务器环境:
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



檢視個人資料 個人網站
« 回覆文章 #5 於: 一月 07, 2006, 10:35:25 下午 »

..................
请问有没有办法和 index.template一样呢? 只是中间的maincolumn部份替换我自己的内容...谢谢!
辦法是一定有的 微笑 ,就是做一個精簡一點的 summarydefaultaction 吧!
1.先在複製一份 index.template 模版,將中間 main column 換成你要的內容。假設叫 infohelp.template.
2.你可以在 class/summary/action 裡面,複製 dummarydefaultaction.class.php 成另一個檔案,例如 infohelpaction.class.php ,然後修改裡面的程式:

2.1把第31行改成如下:
引用
$this->_view = new SummaryCachedView( "indexinfohelp", Array( "summary" => "defaultinfohelp", "locale" => $this->_locale->getLocaleCode()));

2.2把取出中間 main comumn 文章的程式碼部份拿掉(其實不拿掉也無所謂啦!如果你不計較效能的話),如下(第46行):
引用
$recentBlogs = $stats->getRecentBlogs( $this->_numPosts );
還有第55行也刪掉:
引用
$this->_view->setValue( "recentBlogs", $recentBlogs );

3.最後在 header.tempalte 的 nav bar 處加上你要的連結:
引用

應該就可以了。

附帶說明:
1.以上想法我還沒驗證,但依我的經驗,應該可以,你自己試試吧!
2.行號部份也許不同,若不同的話應該在附近,請仔細找找。
3.請先備份後再試,以免發生慘案  吐舌頭

最後,請再回來與我們分享你的成果囉!獨樂樂不如眾樂樂,取之社群,回饋社群。

lss
已記錄

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


檢視個人資料
« 回覆文章 #6 於: 一月 08, 2006, 02:09:10 下午 »

 開懷大笑 谢谢 les的回复...

我用你提供的步骤试验了一下, 没有成功.. 害羞...不知道哪里有问题..
还有就是用
程式碼:
http://BLOG-URL/summary.php?op=infohelp
来访问,还是使用
程式碼:
http://BLOG-URL/summary.php?op=display&page=infohelp
来访问呢?

我使用 op=infohelp 一直显示的是summary页面, 使用 op=display&page=infohelp 能显示出infohelp.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



檢視個人資料 個人網站
« 回覆文章 #7 於: 一月 08, 2006, 02:17:52 下午 »

hi yufeng:

把你改的部份全部貼上來吧!有空時幫你看看!

lss
已記錄

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


檢視個人資料
« 回覆文章 #8 於: 一月 08, 2006, 07:22:20 下午 »

谢谢les.. 開懷大笑, 下面是我修改的一些文件的源码

class/summary/action/infohelpaction.class.php(由summarydefaultaction.class.php复制)
程式碼:
<?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" );

     
/**
      * 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"[b][color=Red]infohelp[/color][/b]", Array( "summary" => "[b][color=Red]infohelp[/color][/b]""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->getAllBlogstrue );
            
$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 );

$this->setCommonData();

            return 
true;
        }
     }
?>




templates/summary/infohelp.template(由index.template复制)
程式碼:
{include file="summary/header.template" selected="index"}

<div id="column-left">
    <div id="summary_login">
<form id="loginForm" method="post" action="admin.php">
    <fieldset class="inputField" >
        <h4>{$locale->tr("login")}</h4>
<div id="login_bg">
<div class="field">
            <label for="userName">{$locale->tr("username")}</label>
            <input type="text" tabindex="10" name="userName" id="userName" value="" maxlength="50" />
        </div>   
        <div class="field">
            <label for="userPassword">{$locale->tr("password")}</label>
            <input type="password" tabindex="11" name="userPassword" id="userPassword" maxlength="50" />
        </div>
        <input type="submit" class="button" name="Login" value="{$locale->tr("login")}" tabindex="12" id="login"/>
        <input type="hidden" name="op" value="Login" />
    <span style="float:right; margin-top:-20px;"><a href="?op=resetPasswordForm">{$locale->tr("password_forgotten")}</a></span>
</div>
    </fieldset>
    </form>
</div>
    <div id="newblogs">
<h4>{$locale->tr("summary_newest_blogs")}</h4>
    <ul class="itemList">
    {foreach from=$recentBlogs item=blog}
        {assign var="url" value=$blog->getBlogRequestGenerator()}
{** remove this if you're having problems with blogs in encondings other than iso-8859-1 **}
        <li class="item"><a href="{$url->blogLink()}" title="{$blog->getBlog()|strip_tags}">{$blog->getBlog()|strip_tags|truncate:30:"..."}</a></li>
    {/foreach}
    </ul>
</div>
<div id="links">
<h4>{$locale->tr("summary_links")}</h4>
<ul>
<li><a href="http://www.revefrance.com/bbs" target="_blank">a</a></li>
<li><a href="http://www.revefrance.com" target="_blank">b</a></li>
<li><a href="http://www.revefrance.com" target="_blank">c</a></li>
<li><a href="http://www.revefrance.com" target="_blank">d</a></li>
</ul>
</div>
<!--<div id="links">
<h4>{$locale->tr("summary_statistics")}</h4>
<ul>
<li><a href="http://www.revefrance.com/bbs" target="_blank">a</a></li>
<li><a href="http://www.revefrance.com" target="_blank">f</a></li>
<li><a href="http://www.revefrance.com" target="_blank">e</a></li>
<li><a href="http://www.revefrance.com" target="_blank">w</a></li>
</ul>
</div>-->
</div>

<div id="maincolumn">
    <div id="intro">
        <div id="intro_title">
<div id="fp_left"><img src="imgs/fp_left.jpg" /></div>
<div id="title">{$locale->tr("summary_welcome")}</div>
<div id="fp_right"><img src="imgs/fp_right.jpg" /></div>
</div>
<div id="intro_text">
欢迎欢迎,热烈欢迎...
You should place here whatever welcome message you would like your users to see. Or remove
this one completely and rearrange the whole page. Or something :) Take a look at
templates/summary, that is where all template files that make up this page are stored. You are
free to change them in any way you like.
</div>
    </div>
   
<div id="help">Our help information put here...</div>

<div id="privacy" style="display:none;">{include file="summary/info_privacy.template"}</div>
<div id="statement" style="display:none;">{include file="summary/info_statement.template"}</div>
<div id="aboutus" style="display:none;">{include file="summary/info_aboutus.template"}</div>
<div id="contact" style="display:none;">{include file="summary/info_contact.template"}</div>
<div id="help" style="display:none;">{include file="summary/info_help.template"}</div>
<script src="js/ui/info.js" type="text/javascript"></script>
</div>

<div id="column-right">
    <form id="searchForm" method="post" action=".">
    <fieldset class="inputField">
        <div id="search_title"><img src="imgs/new/search.gif" width="16" height="16" />{$locale->tr("summary_search_blogs")}</div>
        <div id="search_box">
<div class="field">
            <label for="searchTerms">{$locale->tr("search_terms")}</label><br />
            <input type="text" tabindex="20" name="searchTerms" id="searchTerms" value="" />
        </div>
        <input type="hidden" name="op" value="summarySearch" />           
        <input type="submit" class="button" name="summarySearch" value="{$locale->tr("search")}" tabindex="21" id="summarysearch"/>
</div>
    </fieldset>
    </form>
    <div id="mab_title">{$locale->tr("summary_most_active_blogs")}</div>
    <ul class="itemList">
    {foreach from=$activeBlogs item=blog}
    {assign var="url" value=$blog->getBlogRequestGenerator()}
        <li class="item"><a href="{$url->blogLink()}"  title="{$blog->getBlog()|strip_tags}">{$blog->getBlog()|strip_tags|truncate:23:"..."}</a></li>
    {/foreach}
    </ul>

    <div id="mca_title">{$locale->tr("summary_most_commented_articles")}
    {if $commentedPosts}
      <a href="{$url->getRssUrl()}?summary=1&amp;type=mostcommented" >
        <img src="{$url->getUrl("/imgs/rss_logo_small.gif")}" alt="RSS"/></a>
    {/if}   
</div>
    {foreach name=commented from=$commentedPosts item=post}
       {if $smarty.foreach.commented.first}
         <ul class="itemList">
       {/if}
    {assign var="blog" value=$post->getBlogInfo()}
    {assign var="url" value=$blog->getBlogRequestGenerator()}
        <li class="item">
            <a href="{$url->postPermalink($post)}" title="{$post->getTopic()|strip_tags}">{$post->getTopic()|strip_tags|truncate:18:"..."} ({$post->getTotalComments()})</a><br />
        </li>
       {if $smarty.foreach.commented.last}
         </ul>
       {/if}
    {/foreach}

    <div id="mra_title">{$locale->tr("summary_most_read_articles")}
      {if $readestBlogs}
        <a href="{$url->getRssUrl()}?summary=1&amp;type=mostread">
          <img src="{$url->getUrl("/imgs/rss_logo_small.gif")}"
          alt="RSS" /></a>
      {/if}
     </div>
    {foreach name=readest from=$readestBlogs item=post}
       {if $smarty.foreach.readest.first}
         <ul class="itemList">
       {/if}
    {assign var="blog" value=$post->getBlogInfo()}
    {assign var="url" value=$blog->getBlogRequestGenerator()}
        <li class="item">
            <a href="{$url->postPermalink($post)}" title="{$post->getTopic()|strip_tags}">{$post->getTopic()|strip_tags|truncate:17:"..."} ({$post->getNumReads()})</a><br />
        </li>
       {if $smarty.foreach.readest.last}
         </ul>
       {/if}
    {/foreach}
</div>
</div><br />
{include file="summary/footer.template"}

上面就是2个修改的文件...谢谢各位...
已記錄

服务器环境:
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



檢視個人資料 個人網站
« 回覆文章 #9 於: 一月 08, 2006, 08:50:02 下午 »

hi yufeng:

我漏掉了兩個地方:
1.  class/summary/action/infohelpaction.class.php 裡面宣告的 class 和建構子函數名稱也要改成 infohelp 。
2. summary.php 下方要把 infohelp 這個 op 比照加入 $_actionMap 裡面。

再加上這兩個應該就可以了。

lss
已記錄

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


檢視個人資料
« 回覆文章 #10 於: 一月 08, 2006, 11:32:55 下午 »

hi, les 谢谢你的回复, 我根据你的提示修改了一下, 但是还是看不到相应的页面...可能有些地方我没有正确修改吧...下面是我修改的一些代码:

infohelpaction.class.php
程式碼:
 class InfoHelpAction extends SummaryAction
     {

        var $_numPosts;

        function InfoHelpAction( $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( "infohelp", Array( "summary" => "infohelp", "locale" => $this->_locale->getLocaleCode()));

summary.php添加了一行:
程式碼:
$_actionMap["InfoHelp"] = "InfoHelpAction";

 微笑
« 最後編輯時間: 一月 09, 2006, 09:55:18 上午 由 yufeng » 已記錄

服务器环境:
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



檢視個人資料 個人網站
« 回覆文章 #11 於: 一月 09, 2006, 04:21:54 下午 »

hi yufeng:

我自己驗證過了,沒有問題哦!

我唯一想得到你會遇到的問題,請注意大小寫。網址上的 op="InfoHelp" 要和 $_actionMap["InfoHelp"]="InfoHelpAction"; 的陣列索引相同。

祝好運!

lss
已記錄

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


檢視個人資料
« 回覆文章 #12 於: 一月 09, 2006, 05:11:31 下午 »

 :-D谢谢les, 是我没有注意大小写的问题... op="InfoHelp" 就ok了...感谢 吐舌頭

另外, 我如果有4,5个这样的页面的话就需要把这个步骤重复4,5遍吧? 复制4,5个.class.php文件, 然后生成4,5个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



檢視個人資料 個人網站
« 回覆文章 #13 於: 一月 09, 2006, 07:30:22 下午 »

hi yufeng:

恭喜你,就這樣子啦! 開懷大笑

接下來就等你的心得分享啦!

lss
已記錄

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


我是豬老大


檢視個人資料 個人網站
« 回覆文章 #14 於: 一月 09, 2006, 08:21:08 下午 »

LSS老師的這個方法好!
我之前也是碰到這個問題
因為不懂怎麼修改,只好放棄
讓新增的頁面變成一個獨立的畫面
只是咧,每次更新版本就得在動手修改一次 吐舌頭
已記錄

我的虛擬主機基本資料如下
Operating system: Linux
Apache version: 1.3.37
PHP version: 4.4.4
MySQL version: 4.1.21-standard
頁: [1]
LifeType 中文開發論壇  |  開發  |  核心補強  |  请教如何在summary中加入自己的内容? « 上篇主題 下篇主題 »
    前往: