模块开发: Difference between revisions

Tag: 2017 source edit
Line 420: Line 420:
print strftime('%A %d %B %Y', $mydate);
print strftime('%A %d %B %Y', $mydate);
</syntaxhighlight>
</syntaxhighlight>
===Overwrite template file (tpl)===
If you want to overwrite tpl file on your module, you need to declare it on the module_parts :
<syntaxhighlight lang="PHP">
'tpl' => 1,
</syntaxhighlight>
Then you can put any tpl file on '''mymodule/core/tpl'''
as soon as the module is activate, the tpl will be overwrited


==设置配置页面 (可选)==
==设置配置页面 (可选)==
Line 429: Line 437:
创建一个名为 '''mymodule_setuppage.php''' 的PHP页面,显示可能的选项并更新它们。
创建一个名为 '''mymodule_setuppage.php''' 的PHP页面,显示可能的选项并更新它们。


有必要以 '''/admin''' 中的一个页面为例,展示读取或保存选项的方法。将此配置页面也放在'''/admin'''目录中。然后,在模块描述符文件中,修改变量以指定该PHP页面的名称(不需要路径,因为该页面必须在 admin 中)。
有必要以 '''/admin''' 中的一个页面为例,展示读取或保存选项的方法。将此配置页面也放在'''/admin'''目录中。
 
然后,在模块描述符文件中,修改变量以指定该PHP页面的名称(不需要路径,因为该页面必须在 admin 中):


<source lang="php">
<source lang="php">
715

edits