Menu:

Recent Entries

About

Sirius

板工秀勇與阿吉管理中

Categories

xoops [5]
有關模板 [4]
TinyMCE [3]
FreeNX [1]
Ubuntu相關 [1]
系統修改 [4]
MySQL [4]
學用Blog [2]
硬體相關 [2]
Lifetype系統更新 [10]
IMageMagick [1]
校務系統 [3]
Windows相關 [5]
XPress [1]
LightBox [1]
CSS [1]
站務公告 [7]
Plugins套用修改 [3]
設備使用 [1]
Moodle [1]
電腦教室管理 [0]

Links

LiftType教學
- LifeType 線上教學(官網)
- 部落格教室(怡杰老師)
- 阿欣部落
- 阿杰老師部落格教室

Syndicate

RSS 0.90
RSS 1.0
RSS 2.0
Atom 0.3

Version:

andreas01 v1.3

1.2.x模板修改之前

sirius | 14 六月, 2007 07:04

每次LifeType升級,最令人痛苦的一件事就是修改模板。如果碰到升級時還有一些Plugin還來不及釋出升級版,那模版還得先槓掉那段程式碼。

還好李宗欣老師這篇檢查plog的plugin是否啟動的指令 ,與這篇文章下的迴響告訴我如何解決這個問題。如果再改版也不怕了!

以下引用自李宗欣老師上述兩篇文章:


檢查plog的plugin是否啟動的指令

{if !empty($recentcomments)} // 檢查 plugin 存不存在
{if $recentcomments->enabled()} // 檢查 plugin 有沒有啟動。
....
....
{/if}
{/if}

這樣就可以避免如果使用者沒裝 plugin 時會造成錯誤。


舉例來說這邊recentcomment的設定
{if $recentcomments->isEnabled()}
<h2>» 最近迴響</h2>
{assign var=comments value=$recentcomments->getRecentComments()}
<ul>
{foreach from=$comments item=comment}
{assign var=commentpostid value=$comment->getArticleId()}
{assign var=commentpost value=$recentcomments->getArticle($commentpostid)}
<li><a href="{$url->postPermalink($commentpost)}#{$comment->getId()}">{$ comment->getUsername()}:{$comment->getText()|truncate:80:".... "|strip_tags}</a></li>
{/foreach}
</ul>
{/if}

在 if 裡面就是要去判斷使用者是否已在管理後台裡啟動了這外掛,
有啟動的話,就會顯示底下的最近迴響的資料,若未啟動,則這一段程式碼就不會顯示

假如沒加上 if 的話,若在模版上加上了那些程式碼,但使用者卻未啟動外掛,則版面上就會出現錯誤訊息。
大概就是這樣。

 

Posted in 有關模板 . 迴響: (39507). 引用:(538). 靜態連結網址
«Next post | Previous post»

Comments

  1. 1. Bea  |  10/17,2021 at 21:15

    Asking questions are actually nice thing if
    you are not understanding something totally,
    except this article offers fastidious understanding even.

  2. 2. http://135.148.164.91  |  10/17,2021 at 21:15

    I'm no longer sure the place you are getting your information,
    but good topic. I needs to spend some time studying much
    more or working out more. Thanks for great
    info I used to be in search of this information for
    my mission.

  3. 3. Hazel  |  10/17,2021 at 21:14

    Pretty nice post. I just stumbled upon your blog and wished to say that I've really enjoyed surfing around your blog posts.
    In any case I will be subscribing to your rss feed and I hope you write again soon!

  4. 4. Dewitt  |  10/17,2021 at 21:14

    Aw, this was a really nice post. Finding the time and
    actual effort to generate a great article…
    but what can I say… I procrastinate a whole lot and never seem to get nearly anything done.

  5. 5. pg.dev.timelabs.ru  |  10/17,2021 at 21:13

    Hi there it's me, I am also visiting this website regularly,
    this website is genuinely pleasant and the visitors are truly sharing nice thoughts.

  6. 6. herpesyl.com/  |  10/17,2021 at 21:13

    Does your site have a contact page? I'm having trouble locating it but, I'd like to shoot you an e-mail.
    I've got some creative ideas for your blog you might be interested in hearing.
    Either way, great blog and I look forward to seeing it
    improve over time.

  7. 7. phenq bbb  |  10/17,2021 at 21:13

    constantly i used to read smaller posts that as well
    clear their motive, and that is also happening with this piece of writing which I am reading at this place.

  8. 8. Guillermo  |  10/17,2021 at 21:12

    I am curious to find out what blog system you have been using?
    I'm experiencing some minor security issues with my latest site and I would like to find something more safe.
    Do you have any solutions?

  9. 9. https://Www.boutiquebeauties.com  |  10/17,2021 at 21:11

    slot

  10. 10. Rudolph  |  10/17,2021 at 21:11

    Hey! I just wanted to ask if you ever have any
    trouble with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup.

    Do you have any solutions to prevent hackers?

  11. 11. Milagros  |  10/17,2021 at 21:10

    What's up mates, how is the whole thing, and what you want to
    say concerning this paragraph, in my view its genuinely
    amazing in support of me.

  12. 12. Hayley  |  10/17,2021 at 21:10

    I like the valuable info you provide in your articles.
    I will bookmark your weblog and check again here frequently.
    I'm quite sure I'll learn a lot of new stuff right here!
    Good luck for the next!

  13. 13. Rodger  |  10/17,2021 at 21:10

    This is a topic that's close to my heart... Thank you!
    Where are your contact details though?

  14. 14. Faustino  |  10/17,2021 at 21:08

    Hi colleagues, its great article on the topic of educationand fully explained,
    keep it up all the time.

  15. 15. Rosemarie  |  10/17,2021 at 21:08

    Hi my family member! I wish to say that this post is amazing, great
    written and include approximately all significant infos.
    I would like to peer more posts like this .

  16. 16. Norberto  |  10/17,2021 at 21:08

    Great article. I will be going through many of
    these issues as well..

  17. 17. https://rhodeislandcomedy.com/forum/profile/stacysanderson3/  |  10/17,2021 at 21:08

    Hey there! I could have sworn I've been to this blog before but after reading
    through some of the post I realized it's new to me.

    Anyhow, I'm definitely delighted I found it and I'll be book-marking and checking back
    often!

  18. 18. Louise  |  10/17,2021 at 21:08

    Nice blog here! Also your web site loads up fast!
    What host are you using? Can I get your affiliate link to
    your host? I wish my website loaded up as quickly as
    yours lol

  19. 19. learn more  |  10/17,2021 at 21:07

    Normally I don't learn article on blogs, however I wish
    to say that this write-up very forced me to take a look at and do so!
    Your writing taste has been surprised me. Thanks, very great article.

  20. 20. destroy herpes out of your body  |  10/17,2021 at 21:06

    Wow, this piece of writing is good, my younger sister is analyzing such things, so I am going to inform her.

Leave a Reply

發表迴響
 authimage