模块开发: Difference between revisions

Line 604: Line 604:
</syntaxhighlight>
</syntaxhighlight>


===Test your style sheet===
===测试您的样式表===
Disable and enable your module.
停用并重新激活模块。


Go on home page (index.php). Show the HTML source of the page.
前往Dolibarr的主页。查看页面的HTML源代码。


You should see into the HTML header, a line that declare your style sheet.
您应该在HTML标头中看到有一行是声明您的样式表。


==增加JS函数功能 (可选)==
==定义Javascript函数 (可选)==
'''When''': If in your PHP pages, you use javascript functions not available in Dolibarr (in file lib_head.js)
'''何时''':当您在PHP屏幕页面中使用的 javascript 函数不是Dolibarr的标准js函数(在lib_head.js中)。


If you need to use your own javascript functions inside your PHP pages, it is necessary to have your functions, defined into your  javascript file '''htdocs/mymodule/js/mymodule.js''', included into the HTML HEAD section.
如果在PHP屏幕页面上使用 javascript 函数,则必须将在 javascript 文件 '''htdocs/mymodule/js/mymodule.js''' 中声明的函数加载到HTML头中。
To ask Dolibarr that forge this header to include your own javascript file, you must just provide it to the llxHeader() function called by your page.
 
若要求Dolibarr(负责生成 header 部分)包含一个 javascript 文件,必须在页面开头调用的llxHeader()函数的参数中提供包含要包含的JS URL的参数。
 
页面 /htdocs/mymodule/mypage.php 的示例:


Example for page /htdocs/mymodule/mypage.php :
<syntaxhighlight lang="PHP">
<syntaxhighlight lang="PHP">
$morejs=array("/mymodule/js/mymodule.js");
$morejs=array("/mymodule/js/mymodule.js");
715

edits