<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨心蕓蕓 @ JPeanut(舊版)

    搬遷至 http://www.17m.net.cn/

    BlogJava 首頁 新隨筆 聯系 聚合 管理
      43 Posts :: 0 Stories :: 54 Comments :: 0 Trackbacks
    ?[翻譯:陳市明 摘自:http://drupal.org/node/82926]
    ?? 在5.x中,你模塊的基本信息不再是通過函數hook_help提供給Drupal,而是在info文件定義name和description即可(具體格式參見info文件指南)。在我們的例子中,該文件為onthisdate.info
    ?通常格式如下:
    ;?$Id$
    name?
    =?Module?Name
    description?
    =?"A?description?of?what?your?module?does."

    如果沒有這個文件,則drupal不能在模塊安裝的時候找到該模塊。
    在我們的例子中,onthisdate.info應該包含如下數據:
    ;?$Id$
    name?
    =?On?this?date
    description?
    =?"A?block?module?that?lists?links?to?content?such?as?blog?entries?or?forum?discussions?that?were?created?one?week?ago."
    將把這些代碼寫到onthisdate.info文件中,保存到sites/all/modules/onthisdate目錄
    下面3句是在info文件中是可選的
    dependencies?=?module1?module2?module3
    package?=?"Your?arbitrary?grouping?string"
    version?
    =?"$Name$"
    在我們的例子中,將不使用這些代碼。如果你的模塊依賴其他模塊,則Drupal在你的依賴模塊沒有被激活的情況下是不允許激活的。
    Package:在模塊列表頁面中的顯示分組,如果該值為空則默認為“Uncategorized”。
    Version:通過cvs直接得到的模塊的版本號
    該文件使用的是ini格式,所以該文件可以包含;表示注釋;
    ; $Id$則讓cvs自動把該文件的ID信息自動替換掉
    關于ini的格式,具體參見PHP.net parse_ini_file documentation

    除了info文件,我們還可以通過實現help鉤子來添加額外的幫助信息。不管怎么樣,最好還是實現help鉤子。onthisdate模塊的help鉤子叫做onthisdate_help:
    <?php
    function?onthisdate_help($section
    ='')?{
    }
    ?>
    $section變量:是該頁面的結點路徑。官方推薦,最好在模塊中通過swtich case語句來判斷是否是該模塊的結點路徑。你可以參照如下代碼:
    <?php
    /**
    *?顯示幫助和模塊信息
    *?
    @param?當前幫助結點的路徑#模塊名
    *?
    @return?顯示的幫助信息
    */
    function?onthisdate_help($section
    ='')?{
    ??$output?
    =?'';
    ??
    switch?($section)?{
    ????
    case?"admin/help#onthisdate":
    ??????$output?
    =?'<p>'.??t("Displays?links?to?nodes?created?on?this?date").?'</p>';
    ??????
    break;
    ??}
    ??
    return?$output;
    }?
    //?function?onthisdate_help
    ?>
    把這些代碼寫到onthisdate.module文件中,保存到目錄sites/all/modules/onthisdate



    原文:


    In?Drupal?5.x?the?basic?information?about?your?module,?its?name?and?description,?is?no?longer?provided?by?hook_help.?Instead,?all?modules?now?need?to?have?a?modulename.info?file,?containing?meta?information?about?the?module?(for?details?see?Writing?.info?files?(Drupal?5.x)).?For?our?example,?"onthisdate.info'.

    The?general?format?is:

    ;?$Id$
    name?
    =?Module?Name
    description?
    =?"A?description?of?what?your?module?does."

    Without?
    this?file,?your?module?will?not?show?up?in?the?module?listing!.

    for?our?example,?it?could?contain?the?following:

    ;?$Id$
    name?
    =?On?this?date
    description?
    =?"A?block?module?that?lists?links?to?content?such?as?blog?entries?or?forum?discussions?that?were?created?one?week?ago."

    Add?the?source?above?to?a?file?named?to?onthisdate.info?before?saving?in?your?module
    's?directory?at?sites/all/modules/onthisdate.

    There?are?also?three?optional?lines?that?may?appear?in?the?.info?file:
    dependencies?
    =?module1?module2?module3
    package?=?"Your?arbitrary?grouping?string"
    version?
    =?"$Name$"

    For?our?example?module,?these?don
    't?apply?and?we?will?simply?omit?them.?If?you?assign?dependencies?for?your?module,?Drupal?will?not?allow?it?to?be?activated?until?the?required?dependencies?are?met.

    If?you?assign?a?
    package?string?for?your?module,?on?the?admin/build/modules?page?it?will?be?listed?with?other?modules?with?the?same?category.?If?you?do?not?assign?one,?it?will?simply?be?listed?as?'Uncategorized'.?Not?assigning?a?package?for?your?module?is?perfectly?ok;?in?general?packages?are?best?used?for?modules?that?are?distributed?together?or?are?meant?to?be?used?together.?If?you?have?any?doubt,?leave?this?field?blank.

    Suggested?examples?of?appropriate?items?
    for?the?package?field:

    ????
    *?Audio
    ????
    *?Bot
    ????
    *?CCK
    ????
    *?Chat
    ????
    *?E-Commerce
    ????
    *?Event
    ????
    *?Feed?Parser
    ????
    *?Organic?groups
    ????
    *?Station
    ????
    *?Video
    ????
    *?Views
    ????
    *?Voting?(if?it?uses/requires?VotingAPI)?

    The?version?line?will?provide?the?version?string?
    for?users?getting?their?modules?directly?from?CVS?rather?than?using?the?tarball?package?that?is?created?with?a?release.

    The?files?use?the?ini?format?and?can?include?a?;?$Id$?to?have?CVS?insert?the?file?ID?information.

    For?more?information?on?ini?file?formatting,?see?the?PHP.net?parse_ini_file?documentation.

    We?can?also?provide?help?and?additional?information?about?our?module.?Because?of?the?use?of?the?.info?file?described?above,?
    this?hook?is?now?optional.?However,?it?is?a?good?idea?to?implement?it.?The?hook?name?for?this?function?is?'help',?so?start?with?the?onthisdate_help?function:

    <?php
    function?onthisdate_help($section
    ='')?{

    }
    ?>

    The?$section?variable?provides?context?
    for?the?help:?where?in?Drupal?or?the?module?are?we?looking?for?help.?The?recommended?way?to?process?this?variable?is?with?a?switch?statement.?You'll?see?this?code?pattern?in?other?modules.

    <?php
    /**
    *?Display?help?and?module?information
    *?
    @param?section?which?section?of?the?site?we're?displaying?help
    *?
    @return?help?text?for?section
    */
    function?onthisdate_help($section
    ='')?{

    ??$output?
    =?'';

    ??
    switch?($section)?{
    ????
    case?"admin/help#onthisdate":
    ??????$output?
    =?'<p>'.??t("Displays?links?to?nodes?created?on?this?date").?'</p>';
    ??????
    break;
    ??}

    ??
    return?$output;
    }?
    //?function?onthisdate_help
    ?>

    The?admin
    /help#modulename?case?is?used?by?the?Drupal?core?to?linked?from?the?main?help?page?(/admin/help?or??q=admin/help).?You?will?eventually?want?to?add?more?text?to?provide?a?better?help?message?to?the?user.

    More?information?about?the?help?hook:
    Drupal?HEAD

    Add?the?source?above?to?a?file?named?to?onthisdate.module?before?saving?in?your?Drupal?installation.?

    posted on 2007-03-27 09:32 陳市明 閱讀(546) 評論(0)  編輯  收藏 所屬分類: 小陳的Drupal專區小陳翻譯
    主站蜘蛛池模板: 久久精品国产亚洲av麻豆蜜芽 | 美女羞羞视频免费网站| 免费无码又爽又刺激高潮视频| 亚洲国产精品一区二区第一页免| 亚洲乱色伦图片区小说| 成年男女男精品免费视频网站| 亚洲福利电影在线观看| 99热在线免费观看| 亚洲神级电影国语版| 18禁无遮挡无码国产免费网站| 亚洲精品线在线观看| 91精品国产免费| 国产免费福利体检区久久| 亚洲第一视频在线观看免费| 国产99久久久国产精免费| 国产亚洲成av人片在线观看| 亚洲一区二区三区四区视频| 无码少妇一区二区浪潮免费| 亚洲一区二区三区国产精华液| 黑人粗长大战亚洲女2021国产精品成人免费视频 | 无码人妻精品中文字幕免费东京热| 亚洲乱亚洲乱淫久久| 久久不见久久见免费视频7| 亚洲国产成人九九综合| 青春禁区视频在线观看直播免费 | 狼人大香伊蕉国产WWW亚洲| 免费在线观看你懂的| 精品国产呦系列在线观看免费| 亚洲AV无码成人精品区天堂| 亚洲免费福利视频| 亚洲成在人线aⅴ免费毛片| 国产成人精品曰本亚洲79ren| 久久国产精品成人免费| 激情综合亚洲色婷婷五月| 国产国产成年年人免费看片| 中文字幕av无码不卡免费| 亚洲黄色片免费看| 免费观看午夜在线欧差毛片| 国产无遮挡裸体免费视频在线观看 | 免费黄色小视频网站| 人体大胆做受免费视频|