User:Rvsjoen/tutorial/Developing a Module/Part 02
From Joomla! Documentation
Adding a module template
In most cases, we want our module to have the ability to display output using a template. We could theoretically code all of this directly into the module php file but using a separate file increases flexibility and gives us the option to override the module output in a template.
So in order to create a module template we need to do two things
- Create the template
- Tell the module to load the template and display it
With your favorite editor, create the following file
tmpl/mod_helloworld.php
<?php
/**
* @package Joomla.Tutorials
* @subpackage Module
* @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
* @license License GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die;
?>
<p>Hello World! I am a module</p>