<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ca">
	<id>https://docs.moodle.org/2x/ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elvedin</id>
	<title>MoodleDocs - Contribucions de l&amp;#039;usuari [ca]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/2x/ca/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Elvedin"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/2x/ca/Especial:Contribucions/Elvedin"/>
	<updated>2026-04-18T05:14:57Z</updated>
	<subtitle>Contribucions de l&amp;#039;usuari</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/2x/ca/index.php?title=NEWMODULE_Tutorial&amp;diff=52363</id>
		<title>NEWMODULE Tutorial</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/2x/ca/index.php?title=NEWMODULE_Tutorial&amp;diff=52363"/>
		<updated>2009-03-10T20:56:20Z</updated>

		<summary type="html">&lt;p&gt;Elvedin: /* Some Basic Regulation for the Beginner PHP Developer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Development:NEWMODULE Documentation|NEWMODULE Documentation]] &amp;gt; Tutorial&lt;br /&gt;
----&lt;br /&gt;
{{Template:Work in progress}}&lt;br /&gt;
== How to Begin the Creation of a New Module ==&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your module. Take care: no capital letter and no numbers in the name. In this example it will be choosen: &amp;quot;widget&amp;quot;.&lt;br /&gt;
# Find/replace all the occorrences of newmodule in each file with the name of your own module.&lt;br /&gt;
# Change the name of the folder containing you new created module to &amp;quot;widget&amp;quot;.&lt;br /&gt;
# Change the name of the file in widget/lang/en_utf8/newmodule.php to &amp;quot;widget.php&amp;quot;.&lt;br /&gt;
# Put your just born widget folder in moodle/mod/.&lt;br /&gt;
# Visit &amp;quot;notification&amp;quot; page of moodle-&amp;gt;Site Administration block.&lt;br /&gt;
# Follow the instruction on the screen.&lt;br /&gt;
&lt;br /&gt;
[[Image:widget.gif]]&lt;br /&gt;
&lt;br /&gt;
== Some Basic Regulation for the Beginner PHP Developer ==&lt;br /&gt;
&lt;br /&gt;
You will probably want to use this set of basic commands:&lt;br /&gt;
* require&lt;br /&gt;
* require_once &lt;br /&gt;
* include &lt;br /&gt;
* include_once &lt;br /&gt;
&lt;br /&gt;
Take in mind the difference between them.&amp;lt;br /&amp;gt;&lt;br /&gt;
The difference between require and include is: require produces a fatal E_ERROR level error which halts execution if the specified file cannot be accessed while include produces a warning E_WARNING which does not halt execution if the specified file cannot be accessed&amp;lt;br /&amp;gt;&lt;br /&gt;
The difference between require and require_once is: require_once checks if the file has been included and does not include it again if it has&amp;lt;br /&amp;gt;&lt;br /&gt;
The difference between include and include_once is: include_once checks if the file has been included and does not include it again if it has&amp;lt;br /&amp;gt;&lt;br /&gt;
Use only xxx to call libraries and use only xxx to include snippets of code written to different files.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember:&lt;br /&gt;
* &#039;&#039;&#039;redirect&#039;&#039;&#039; moves the execution of the code to the target file and you are allowed to call the target file passing it some parameters, for instance: &amp;lt;code php&amp;gt;redirect(&amp;quot;./come_modello/edit.php?id=$cm-&amp;gt;id&amp;quot;);&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;include&#039;&#039;&#039; requires the name of the called file &amp;quot;clean&amp;quot;, without &amp;quot;?id=$cm-&amp;gt;id&amp;quot;, for instance, and the target file is executed as it were written in the place of the calling row.&lt;br /&gt;
&lt;br /&gt;
You need these two informations to correctly include library files into target files called through redirect or include.&lt;br /&gt;
&lt;br /&gt;
== See also: ==&lt;br /&gt;
* [[Development:Blocks|A Step-by-step Guide To Creating Blocks]] &lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Tutorial|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Elvedin</name></author>
	</entry>
	<entry>
		<id>https://docs.moodle.org/2x/ca/index.php?title=NEWMODULE_Tutorial&amp;diff=52362</id>
		<title>NEWMODULE Tutorial</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/2x/ca/index.php?title=NEWMODULE_Tutorial&amp;diff=52362"/>
		<updated>2009-03-10T20:55:21Z</updated>

		<summary type="html">&lt;p&gt;Elvedin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Development:NEWMODULE Documentation|NEWMODULE Documentation]] &amp;gt; Tutorial&lt;br /&gt;
----&lt;br /&gt;
{{Template:Work in progress}}&lt;br /&gt;
== How to Begin the Creation of a New Module ==&lt;br /&gt;
&lt;br /&gt;
# Choose a name for your module. Take care: no capital letter and no numbers in the name. In this example it will be choosen: &amp;quot;widget&amp;quot;.&lt;br /&gt;
# Find/replace all the occorrences of newmodule in each file with the name of your own module.&lt;br /&gt;
# Change the name of the folder containing you new created module to &amp;quot;widget&amp;quot;.&lt;br /&gt;
# Change the name of the file in widget/lang/en_utf8/newmodule.php to &amp;quot;widget.php&amp;quot;.&lt;br /&gt;
# Put your just born widget folder in moodle/mod/.&lt;br /&gt;
# Visit &amp;quot;notification&amp;quot; page of moodle-&amp;gt;Site Administration block.&lt;br /&gt;
# Follow the instruction on the screen.&lt;br /&gt;
&lt;br /&gt;
[[Image:widget.gif]]&lt;br /&gt;
&lt;br /&gt;
== Some Basic Regulation for the Beginner PHP Developer ==&lt;br /&gt;
&lt;br /&gt;
You will probably want to use this set of basic commands:&lt;br /&gt;
* require&lt;br /&gt;
* require_once &lt;br /&gt;
* include &lt;br /&gt;
* include_once &lt;br /&gt;
&lt;br /&gt;
Take in mind the difference between them.&amp;lt;br /&amp;gt;&lt;br /&gt;
The difference between require and include is: require produces a fatal E_ERROR level error which halts execution if the specified file cannot be accessed while include produces a warning E_WARNING which does not halt execution if the specified file cannot be accessed&lt;br /&gt;
The difference between require and require_once is: require_once checks if the file has been included and does not include it again if it has&amp;lt;br /&amp;gt;&lt;br /&gt;
The difference between include and include_once is: include_once checks if the file has been included and does not include it again if it has&amp;lt;br /&amp;gt;&lt;br /&gt;
Use only xxx to call libraries and use only xxx to include snippets of code written to different files.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Remember:&lt;br /&gt;
* &#039;&#039;&#039;redirect&#039;&#039;&#039; moves the execution of the code to the target file and you are allowed to call the target file passing it some parameters, for instance: &amp;lt;code php&amp;gt;redirect(&amp;quot;./come_modello/edit.php?id=$cm-&amp;gt;id&amp;quot;);&amp;lt;/code&amp;gt;&lt;br /&gt;
* &#039;&#039;&#039;include&#039;&#039;&#039; requires the name of the called file &amp;quot;clean&amp;quot;, without &amp;quot;?id=$cm-&amp;gt;id&amp;quot;, for instance, and the target file is executed as it were written in the place of the calling row.&lt;br /&gt;
&lt;br /&gt;
You need these two informations to correctly include library files into target files called through redirect or include.&lt;br /&gt;
&lt;br /&gt;
== See also: ==&lt;br /&gt;
* [[Development:Blocks|A Step-by-step Guide To Creating Blocks]] &lt;br /&gt;
&lt;br /&gt;
[[Category:Developer]]&lt;br /&gt;
[[Category:Tutorial|{{PAGENAME}}]]&lt;/div&gt;</summary>
		<author><name>Elvedin</name></author>
	</entry>
</feed>