歡迎光臨, 訪客. 請先 登入註冊一個帳號.
三月 29, 2024, 08:21:47 上午
19595 文章 在 3865 主題 由 4580 會員
最新註冊會員: aa123aa1
LifeType 中文開發論壇  |  開發  |  外掛程式  |  最新回響recentcomments的isEnabled值? « 上篇主題 下篇主題 »
頁: [1]
作者 主題: 最新回響recentcomments的isEnabled值?  (閱讀 13589 次)
TomexOu
一般會員
***
文章: 117



檢視個人資料
« 於: 四月 02, 2005, 04:21:38 上午 »

plugin安裝都正常,模版中寫道:
     {if $recentcomments->isEnabled()}
       OK!           
     {else}
       Failed!
     {/if}

當果都是failed! 然而,我仍讀取最新迴響值!

只是很奇怪這值怎麼失效狀況下,仍能操作呢?
我查一下原始碼,發現其值是來自:
$this->pluginEnabled = $blogSettings->getValue( "plugin_recentcomments_enabled" );

環境:
win2003/apache 1.3/php 4.3.10/mysql 4.1.9
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #1 於: 四月 03, 2005, 12:06:57 上午 »

同 HiddenInput 的問題,你把 /tmp 清掉試試看。因為這不應該發生的耶! 驚訝

Mark
已記錄

TomexOu
一般會員
***
文章: 117



檢視個人資料
« 回覆文章 #2 於: 四月 03, 2005, 04:33:40 下午 »

手動清了/tmp目錄,後台也設定沒有cache,
執行以下:
程式碼:

   <div class="Sidetitle">
    <h4>最新迴響</h4>
   </div>
   <p>
    {if $recentcomments->isEnabled()}
     {assign var=comments value=$recentcomments->getRecentComments(10)}
     {foreach from=$comments item=comment}
       {assign var=commentpostid value=$comment->getArticleId()}
  {assign var=commentpost value=$recentcomments->getArticle($commentpostid)}
  {assign var=commentdate value=$comment->getDateObject()}

       <li><a title="{$comment->getText()|truncate:100:"..."|strip_tags}" href="{$url->postPermalink($commentpost)}#{$comment->getId()}">{$comment->getUsername()}@{$commentpost->getTopic()}</a> ({$locale->formatDate($commentdate, "%m/%d")})</li>
     {/foreach}
    {else}
      Plugin:recentcomments is required.
    {/if}  
   </p>


出現:Plugin:recentcomments is required. 表示isEnabled=false.

再手動清了/tmp目錄一次,執行下面程式:
程式碼:

   <div class="Sidetitle">
    <h4>最新迴響</h4>
   </div>
   <p>
     {assign var=comments value=$recentcomments->getRecentComments(10)}
     {foreach from=$comments item=comment}
       {assign var=commentpostid value=$comment->getArticleId()}
  {assign var=commentpost value=$recentcomments->getArticle($commentpostid)}
  {assign var=commentdate value=$comment->getDateObject()}

       <li><a title="{$comment->getText()|truncate:100:"..."|strip_tags}" href="{$url->postPermalink($commentpost)}#{$comment->getId()}">{$comment->getUsername()}@{$commentpost->getTopic()}</a> ({$locale->formatDate($commentdate, "%m/%d")})</li>
     {/foreach}
   </p>


拿掉isenabled判斷,明明上次是false,這時候回響值卻出來了!!
超怪~~
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #3 於: 四月 03, 2005, 05:32:07 下午 »

這時候,你如果拿掉那些判斷,當然會顯示。呵呵!

因為 recentcomments 這個 plugin 物件,只要安裝成功後就會存在,所以不管理面有沒有迴響,那麼當然就可以呼叫裡面的 methoed 來做取出迴響內容的動作。

另外 isEnabled() 只是一個 method 用來取出 recentcomment 中的 plugin_recentcomments_enable 這個值,所以當你 disable  recent comment 這個物件,只是代表 這個 plugin_recentcomments_enable 值變成 false, recent comments 這個物件還是存在的阿。所以你當然還是可以存取。

這就是為什麼在模版中要用 isEnabled() 去判斷的原因。

Mark
已記錄

TomexOu
一般會員
***
文章: 117



檢視個人資料
« 回覆文章 #4 於: 四月 03, 2005, 06:25:39 下午 »

或許我不曉得如何enable/disable這些單一plugin的緣故

我的enable的定義是:
把該plugin目錄放進去,在後台plugin控制中心refresh畫面重新載入!
disable定義:
把plugin目錄砍掉,在後台plugin控制中心refresh畫面重新載入!

難道後台能設定單一plugin的enable/disabled!!

我查了一下plugin物件,裏頭的is_enabled是讀取:
$this->pluginEnabled = $blogSettings->getValue( "plugin_recentcomments_enabled" );

我進入db查詢table: plog_config中的 config_key,
並沒有plugin_recentcomments_enabled!
所以不曉得到底db用什麼欄位來記錄載入的狀況。
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
TomexOu
一般會員
***
文章: 117



檢視個人資料
« 回覆文章 #5 於: 四月 03, 2005, 06:27:34 下午 »

我的重點在於,我要讓程式展示在is_enabled的控制中
而不是明明plugin_enabled是false
卻能顯示回響值!!  這是邏輯外的...
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
TomexOu
一般會員
***
文章: 117



檢視個人資料
« 回覆文章 #6 於: 四月 03, 2005, 06:38:14 下午 »

原來,果然,
是我不懂如何enable/disable plugin的緣故!!  嚎啕大哭

refresh plugin載入畫面後,
要回上一頁,會出現這些plugin的設定畫面:


進入設定後,它的enabled才能生效。
我竟沒注意到link增加了...Orz....
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
markwu
系統管理員
超級會員
*****
文章: 3928


Mark Wu


檢視個人資料 個人網站
« 回覆文章 #7 於: 四月 03, 2005, 06:43:46 下午 »

Hi tomex_ou:

1. 把plugin 解壓縮放到 /plugins 的目錄下只是代表安裝完成
2. 目前 plugin 的架構中,並沒有 enable /disable 的 attribute,你所看到的plugin 如  template editor, article referes, recent comment 全是我加上去的
3. enable/disable 這個 attribute 的命名通常是 plugin_pluginname_enable,如 plugin_recentcomments_enable。另外這個值,只是一個 attribute,並不會實質上的『關掉』或是『啟動』這個 plugin,還必須透過模版來控制。
4. 這個 attribute 目前有兩個儲存的方式,用 $config->set(get)Value 或是 getValue ,這是這是用在全域。用 $blogSettings->set(get)Value 這是用在 blog。像是 template editor 的值我就是用 $config 來存,為了只能讓 site admin 來設定。而 recent comments 就是透過 blogSetting 來存為了讓 blog owner 來存。
** $config 存在 plog_config 中
** $blogSetting 存在 plog_blogs 中
5. 當你安裝好後,還必須進入到設定中心的plugin 中來設定這個值,這個值才會存在系統中。否則安裝好時, plugin_recentcomments_enable 是不存在任何DB中的!!

所以你現在的問題是  inEnable() 明明是 false 為什麼 recentcoment 來會顯示。你可以做的實驗

你把 {if $recentcomments->isEnable()}  這個 if statement 拿掉。recentcomment  絕對是可以繼續顯示的。因為就像我上面說的,這只是一個 attribute 用來表示目前的 plugin 是 enable 還是 disable。

但是記得喔。這個值不管為何,只要安裝好,這個plugin 物件 plog 就會自動載入,而且就會有作用。

如果 recent comments 的 template 是包在 {if $recentcomments->isEnable()}  ....{/if} 中,當你在 recent comment 的設定中 disable 後還會顯示,那就代表可能外掛程式有問題。所以我才要你先清掉 cache 試試看。

我建議你把 整個模版 post 上來,才好來討論你希望能達到怎麼樣的效果。

希望這樣的解釋能讓你能比較瞭解plugin 的運作。 開懷大笑

Mark
已記錄

TomexOu
一般會員
***
文章: 117



檢視個人資料
« 回覆文章 #8 於: 四月 03, 2005, 07:40:30 下午 »

謝謝,我已經深刻地了解!
經過設定plugin的啟用後,已經都ok了,也沒有疑慮。
已記錄

我的LifeType測試環境:
Win2003 R2 Enterprise/IE7.0/XAMPP with Apache 2.2.6 + PHP 5.2.4 + MySQL 5.0.45 /LifeType 1.2.5/GD2.0/Grey Template
Dabu網誌
頁: [1]
LifeType 中文開發論壇  |  開發  |  外掛程式  |  最新回響recentcomments的isEnabled值? « 上篇主題 下篇主題 »
    前往: