簡體   English   中英

使用參數創建joomla模塊

[英]Create joomla module with parameters

我是joomla 2.5的新手,我在看有關如何創建模塊的joomla教程,但沒有關於如何向其添加參數的內容。 現在,我要做的是創建了一個模塊,該模塊在頁面上顯示世界問候消息,現在我想在模塊中有一個帶有消息標簽的參數。 這樣,管理員將設置新消息,我可以使用helper.php文件將其返回。

在xml文件中,我必須添加:

<config>
        <fields name="params">
                <fieldset name="basic">
                        <field name="message"  type="text" default="https://osis.extranet.marseille-provence.fr/signalement/new" label="Lien de la page" description="Lien de la page à ouvrir." />
                </fieldset>
        </fields>
</config>

然后在helper.php文件中,我在類的getMessage函數中編寫了此代碼:

jimport('joomla.application.module.helper');
$msg = $params->get('message', 'hello world');
return $msg;

就是這樣,當然不要忘記添加$ params作為函數的參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM