Overwriting Joomla module or component views in the template
Monday, January 26th, 2009Most of the Joomla modules and components have one or more templates that define how the content will be displayed by Joomla. These files are stored in the modules/mod_[module]/tmpl and components/com_[component]/views/[view]/tmpl folders and can be overwritten by the template.
Typical Joomla module has one view and this view is stored in file named default.php in the tmpl folder of the mode. Differently from modules, the standard components have several views, each for different component mode.
For example, the mod_poll module has one view that displays a list of poll options and buttons. The com_content component has several views: archive, article, category, frontpage, section.
Default views of the modules and components may be overwritten in the template by creating a file in specific location: the templates/[template]/html/com_[component]/[view]/ folder for the component and the templates/[template]/html/mod_[module]/ folder for the module. While rendering, Joomla looks into these folders for files that overwrite views and if a file with the same name exists, it uses it instead of the default view file.
The Beez template, shipped with Joomla, overwrites the templates of several components and modules so you can look through its html folder to get examples on how to customize component and module views for different modes.