<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Flimm</id>
	<title>Joomla! Documentation - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.sandbox.joomla.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Flimm"/>
	<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/Special:Contributions/Flimm"/>
	<updated>2026-07-10T03:36:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.0</generator>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Custom_error_pages&amp;diff=259506</id>
		<title>Custom error pages</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Custom_error_pages&amp;diff=259506"/>
		<updated>2015-11-13T09:42:14Z</updated>

		<summary type="html">&lt;p&gt;Flimm: Use getCode() instead of private attribute&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&amp;lt;languages /&amp;gt;&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;{{JSplit}}&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:1--&amp;gt;&lt;br /&gt;
Joomla! uses the &amp;lt;tt&amp;gt;templates/system/error.php&amp;lt;/tt&amp;gt; file to handle several HTTP Status errors, including &amp;quot;403 Forbidden&amp;quot;, &amp;quot;404 Not Found&amp;quot;, and &amp;quot;500 Internal Server&amp;quot; errors. You can style the error results, if desired.&lt;br /&gt;
&amp;lt;/translate&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:2--&amp;gt;&lt;br /&gt;
It is important to understand that &#039;&#039;error.php&#039;&#039; is an independent file from the Joomla! CMS but dependent on the Joomla! Platform. Plugins do not run on the file. You cannot include modules or use  &amp;lt;tt&amp;gt;&amp;lt;jdoc:include&amp;gt;&amp;lt;/tt&amp;gt; statements.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====Overriding the System Error Results==== &amp;lt;!--T:3--&amp;gt;&lt;br /&gt;
To override the system error results, copy the &amp;lt;tt&amp;gt;templates/system/error.php&amp;lt;/tt&amp;gt; file into your &amp;lt;tt&amp;gt;templates/&amp;lt;template-name&amp;gt;&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&amp;lt;/translate&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:4--&amp;gt;&lt;br /&gt;
If it finds one, Joomla! will use the &amp;lt;tt&amp;gt;error.php&amp;lt;/tt&amp;gt; file from the current template, in place of the system file.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:5--&amp;gt;&lt;br /&gt;
You can format the page, as desired, to match your template.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====Overriding the System Styling==== &amp;lt;!--T:6--&amp;gt;&lt;br /&gt;
If you want to change the styling, copy the &amp;lt;tt&amp;gt;templates/system/css/error.css&amp;lt;/tt&amp;gt; file into your &amp;lt;tt&amp;gt;templates/&amp;lt;template-name&amp;gt;/css&amp;lt;/tt&amp;gt; directory.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:7--&amp;gt;&lt;br /&gt;
Next, update your &amp;lt;tt&amp;gt;templates/&amp;lt;template-name&amp;gt;/error.php&amp;lt;/tt&amp;gt; file to reference the new location of the stylesheet by changing this line, accordingly:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;css&amp;quot;&amp;gt;&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;&amp;lt;?php echo $this-&amp;gt;baseurl; ?&amp;gt;/templates/system/css/error.css&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&amp;lt;!--T:8--&amp;gt;&lt;br /&gt;
Then, simply change the &amp;lt;tt&amp;gt;error.css&amp;lt;/tt&amp;gt;, as desired, for your styling requirements.&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====Customizing Error Messages==== &amp;lt;!--T:9--&amp;gt;&lt;br /&gt;
You can add conditional logic to vary the message returned, dependent upon the specific error code.&lt;br /&gt;
&amp;lt;/translate&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:10--&amp;gt;&lt;br /&gt;
Here is an example of how to trap a 404 error and provide a custom message.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php  if ($this-&amp;gt;error-&amp;gt;getCode() == &#039;404&#039;) { ?&amp;gt;&lt;br /&gt;
	&amp;lt;div id=&amp;quot;errorboxheader&amp;quot;&amp;gt;Page not found&amp;lt;/div&amp;gt;&lt;br /&gt;
		&amp;lt;div id=&amp;quot;errorboxbody&amp;quot;&amp;gt;&amp;lt;p&amp;gt;Sorry! That page cannot be found.&amp;lt;/p&amp;gt;&lt;br /&gt;
		&amp;lt;/div&amp;gt;&lt;br /&gt;
	&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;?php } ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====HTTP Status Code==== &amp;lt;!--T:11--&amp;gt;&lt;br /&gt;
When a request is made for a page on your site, the server returns an HTTP status code in response to the request. Joomla! returns a &#039;200 - the server successfully returned the page&#039; for error pages. This is problematic for those working with Google Webmaster Services and trying to get a sitemap resolved.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:12--&amp;gt;&lt;br /&gt;
If you want Joomla! to return a status code for the error, you can do so by adding logic before the DOCTYPE line, as follows:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php &lt;br /&gt;
if ($this-&amp;gt;error-&amp;gt;getCode() == &#039;404&#039;) {&lt;br /&gt;
	header(&amp;quot;HTTP/1.0 404 Not Found&amp;quot;);&lt;br /&gt;
} ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====More HTTP Status Code Information==== &amp;lt;!--T:13--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:14--&amp;gt;&lt;br /&gt;
* [[S:MyLanguage/Create_a_Custom_404_Error_Page|Create a Custom 404 Error Page]]&lt;br /&gt;
* [http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html HTTP/1.1 Status Code Definitions]&lt;br /&gt;
* [[wikipedia:List_of_HTTP_status_codes|List of HTTP status codes]]&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
====Using Theme Header and Footer on Standard Error Page==== &amp;lt;!--T:15--&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
{{JVer|1.5}}&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:16--&amp;gt;&lt;br /&gt;
If you want to see the error page in theme design and don&#039;t like redirecting to error page URL or duplicating HTML in the error page template, here is a way to apply your theme template to the error page.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:17--&amp;gt;&lt;br /&gt;
First, put the following code in &amp;lt;tt&amp;gt;templates/&amp;lt;template-name&amp;gt;/error.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
// no direct access&lt;br /&gt;
defined( &#039;_JEXEC&#039; ) or die( &#039;Restricted access&#039; );&lt;br /&gt;
&lt;br /&gt;
include dirname(__FILE__) . &amp;quot;/index.php&amp;quot;;&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:18--&amp;gt;&lt;br /&gt;
Then make the following edits to &amp;lt;tt&amp;gt;templates/&amp;lt;template-name&amp;gt;/index.php&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:19--&amp;gt;&lt;br /&gt;
1. Find the following code in &amp;lt;tt&amp;gt;index.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;head&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:20--&amp;gt;&lt;br /&gt;
and replace it with the following&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if (!$this-&amp;gt;error-&amp;gt;getCode()) : ?&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;head&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php else : ?&amp;gt; &lt;br /&gt;
&amp;lt;title&amp;gt;&amp;lt;?php echo $this-&amp;gt;error-&amp;gt;getCode() ?&amp;gt; - &amp;lt;?php echo $this-&amp;gt;title; ?&amp;gt;&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;?php endif; ?&amp;gt;  &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:21--&amp;gt;&lt;br /&gt;
2. Find the following code in &amp;lt;tt&amp;gt;index.php&amp;lt;/tt&amp;gt;&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;component&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:22--&amp;gt;&lt;br /&gt;
and replace it with the following&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php if ($this-&amp;gt;error-&amp;gt;getCode()) : /* check if we are on error page, if yes - display error message */ ?&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;?php echo $this-&amp;gt;error-&amp;gt;getCode() ?&amp;gt; - &amp;lt;?php echo $this-&amp;gt;error-&amp;gt;message ?&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_NOT_ABLE_TO_VISIT&#039;); ?&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
  &amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_AN_OUT_OF_DATE_BOOKMARK_FAVOURITE&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_SEARCH_ENGINE_OUT_OF_DATE_LISTING&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_MIS_TYPED_ADDRESS&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_YOU_HAVE_NO_ACCESS_TO_THIS_PAGE&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_REQUESTED_RESOURCE_WAS_NOT_FOUND&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_ERROR_HAS_OCCURRED_WHILE_PROCESSING_YOUR_REQUEST&#039;); ?&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ol&amp;gt;&lt;br /&gt;
  &amp;lt;p&amp;gt;&amp;lt;strong&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_PLEASE_TRY_ONE_OF_THE_FOLLOWING_PAGES&#039;); ?&amp;gt;&amp;lt;/strong&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;ul&amp;gt;&lt;br /&gt;
  &amp;lt;li&amp;gt;&amp;lt;a href=&amp;quot;&amp;lt;?php echo $this-&amp;gt;baseurl; ?&amp;gt;/index.php&amp;quot; title=&amp;quot;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_GO_TO_THE_HOME_PAGE&#039;); ?&amp;gt;&amp;quot;&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_HOME_PAGE&#039;); ?&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
  &amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;p&amp;gt;&amp;lt;?php echo JText::_(&#039;JERROR_LAYOUT_PLEASE_CONTACT_THE_SYSTEM_ADMINISTRATOR&#039;); ?&amp;gt;.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;?php else : ?&amp;gt;&lt;br /&gt;
  &amp;lt;jdoc:include type=&amp;quot;component&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;?php endif; ?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:23--&amp;gt;&lt;br /&gt;
Now your theme template is applied to error pages too.&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:24--&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039; Module includes in template will not work on error page created by this method (but will work on other pages).&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&amp;lt;translate&amp;gt;&lt;br /&gt;
&amp;lt;!--T:25--&amp;gt;&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
[[Category:Template Development]]&lt;br /&gt;
&amp;lt;/translate&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Creating_a_basic_Joomla!_template&amp;diff=198709</id>
		<title>Creating a basic Joomla! template</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Creating_a_basic_Joomla!_template&amp;diff=198709"/>
		<updated>2015-06-29T16:08:01Z</updated>

		<summary type="html">&lt;p&gt;Flimm: Don&amp;#039;t hardcode template name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{version/tutor|1.5,2.5,3.1}}{{JSplit}}&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
The purpose of this tutorial is to serve as an introduction to creating Joomla! templates. It will cover the essential files and code needed to create a basic template. The code is presented so it can be cut and pasted with very little modification needed.&lt;br /&gt;
&lt;br /&gt;
== Setting up a directory structure ==&lt;br /&gt;
To make the most basic template, &#039;&#039;&#039;create a new folder&#039;&#039;&#039; in the &#039;&#039;templates&#039;&#039; folder. Name this folder after your template i.e. &#039;&#039;mynewtemplate&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Using your favourite text editor create the files &amp;lt;code&amp;gt;index.php&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;templateDetails.xml&amp;lt;/code&amp;gt;.&lt;br /&gt;
To keep things organized, make &#039;&#039;&#039;2 new folders&#039;&#039;&#039; called &#039;&#039;images&#039;&#039; and &#039;&#039;css&#039;&#039;. Inside the &#039;&#039;css&#039;&#039; folder create a file called &amp;lt;code&amp;gt;template.css&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Although it is fine to place all your [[CSS]] code directly in your index.php file to start, many web developers prefer to place their CSS code in a separate file that can be linked from multiple pages using the &amp;lt;code&amp;gt;link&amp;lt;/code&amp;gt; tag. This may also shorten the loading time of your pages, since the separate file can be cached.&lt;br /&gt;
&lt;br /&gt;
This is the most basic practical setup. Outline of folder and file structure:&lt;br /&gt;
* mynewtemplate/&lt;br /&gt;
** css/&lt;br /&gt;
*** template.css&lt;br /&gt;
** images/&lt;br /&gt;
** index.php&lt;br /&gt;
** templateDetails.xml&lt;br /&gt;
&lt;br /&gt;
== Creating a basic templateDetails.xml file ==&lt;br /&gt;
The &amp;lt;tt&amp;gt;templateDetails.xml&amp;lt;/tt&amp;gt; file is essential. Without it, your template won&#039;t be seen by Joomla!. The file holds key [[Wikipedia:Metadata|metadata]] about the template. &lt;br /&gt;
&lt;br /&gt;
The syntax of the file is different for each Joomla version.&lt;br /&gt;
&lt;br /&gt;
For {{JVer|1.5}}, use the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE install PUBLIC &amp;quot;-//Joomla! 1.5//DTD template 1.0//EN&amp;quot; &amp;quot;http://www.joomla.org/xml/dtd/1.5/template-install.dtd&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;install version=&amp;quot;1.5&amp;quot; type=&amp;quot;template&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;mynewtemplate&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2008-05-01&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john@example.com&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.com&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;John Doe 2008&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;GNU/GPL&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0.2&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;My New Template&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;files&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;templateDetails.xml&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;images&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;css&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;positions&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;breadcrumb&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;left&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;right&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;top&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user1&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user2&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user3&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user4&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;footer&amp;lt;/position&amp;gt;&lt;br /&gt;
	&amp;lt;/positions&amp;gt;&lt;br /&gt;
&amp;lt;/install&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For {{JVer|2.5}} and later, use the following version. Change &amp;lt;code&amp;gt;version=&amp;quot;2.5&amp;quot;&amp;lt;/code&amp;gt; into the version of your Joomla! installation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot;?&amp;gt;&lt;br /&gt;
&amp;lt;extension version=&amp;quot;2.5&amp;quot; type=&amp;quot;template&amp;quot;&amp;gt;&lt;br /&gt;
	&amp;lt;name&amp;gt;mynewtemplate&amp;lt;/name&amp;gt;&lt;br /&gt;
	&amp;lt;creationDate&amp;gt;2008-05-01&amp;lt;/creationDate&amp;gt;&lt;br /&gt;
	&amp;lt;author&amp;gt;John Doe&amp;lt;/author&amp;gt;&lt;br /&gt;
	&amp;lt;authorEmail&amp;gt;john@example.com&amp;lt;/authorEmail&amp;gt;&lt;br /&gt;
	&amp;lt;authorUrl&amp;gt;http://www.example.com&amp;lt;/authorUrl&amp;gt;&lt;br /&gt;
	&amp;lt;copyright&amp;gt;John Doe 2008&amp;lt;/copyright&amp;gt;&lt;br /&gt;
	&amp;lt;license&amp;gt;GNU/GPL&amp;lt;/license&amp;gt;&lt;br /&gt;
	&amp;lt;version&amp;gt;1.0.2&amp;lt;/version&amp;gt;&lt;br /&gt;
	&amp;lt;description&amp;gt;My New Template&amp;lt;/description&amp;gt;&lt;br /&gt;
	&amp;lt;files&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;index.php&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;filename&amp;gt;templateDetails.xml&amp;lt;/filename&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;images&amp;lt;/folder&amp;gt;&lt;br /&gt;
		&amp;lt;folder&amp;gt;css&amp;lt;/folder&amp;gt;&lt;br /&gt;
	&amp;lt;/files&amp;gt;&lt;br /&gt;
	&amp;lt;positions&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;breadcrumb&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;left&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;right&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;top&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user1&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user2&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user3&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;user4&amp;lt;/position&amp;gt;&lt;br /&gt;
		&amp;lt;position&amp;gt;footer&amp;lt;/position&amp;gt;&lt;br /&gt;
	&amp;lt;/positions&amp;gt;&lt;br /&gt;
&amp;lt;/extension&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So, as you can see, we have a set of information between markup tags (the &amp;lt;code&amp;gt;&amp;lt;element&amp;gt;&amp;lt;/code&amp;gt;s). Your best approach is to cut and paste this into your &amp;lt;tt&amp;gt;templateDetails.xml&amp;lt;/tt&amp;gt; file and change the relevant bits (such as &amp;lt;code&amp;gt;&amp;lt;name&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;author&amp;gt;&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;&amp;lt;files&amp;gt;&amp;lt;/code&amp;gt; part should contain all the files that you use - you possibly don&#039;t know what they are called yet - don&#039;t worry, update it later. The &amp;lt;code&amp;gt;&amp;lt;folder&amp;gt;&amp;lt;/code&amp;gt; element can be used to define an entire folder at once.&lt;br /&gt;
&lt;br /&gt;
Leave the positions as they are - these are a common set so you will be able to switch easily from the standard templates.&lt;br /&gt;
&lt;br /&gt;
== Creating a basic index.php file ==&lt;br /&gt;
{{:Creating a basic index file}}&lt;br /&gt;
&lt;br /&gt;
This leaves a final file of:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php defined(&#039;_JEXEC&#039;) or die(&#039;Restricted access&#039;);?&amp;gt;&lt;br /&gt;
&amp;lt;!DOCTYPE html&amp;gt;&lt;br /&gt;
&amp;lt;html xml:lang=&amp;quot;&amp;lt;?php echo $this-&amp;gt;language; ?&amp;gt;&amp;quot; lang=&amp;quot;&amp;lt;?php echo $this-&amp;gt;language; ?&amp;gt;&amp;quot; &amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;head&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;&amp;lt;?php echo $this-&amp;gt;baseurl ?&amp;gt;/templates/&amp;lt;?php echo $this-&amp;gt;template ?&amp;gt;/css/template.css&amp;quot; type=&amp;quot;text/css&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;modules&amp;quot; name=&amp;quot;top&amp;quot; /&amp;gt; &lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;component&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;jdoc:include type=&amp;quot;modules&amp;quot; name=&amp;quot;bottom&amp;quot; /&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Testing the template ==&lt;br /&gt;
Find the template in the Template Manager, select it and click &#039;&#039;&#039;Default&#039;&#039;&#039; to make it the default template.&lt;br /&gt;
&lt;br /&gt;
{{JVer|1.5}} In Joomla! 1.5, your new template will show up immediately in the [[Help15:Screen.templates.15|Template Manager]], accessible via Extensions -&amp;gt; Template Manager.&lt;br /&gt;
&lt;br /&gt;
{{JVer|2.5}}+ In the Joomla! 2.5 series and later, you first need to tell Joomla! that you have created a new template. This feature is called &#039;&#039;Discover Extensions&#039;&#039; and can be accessed via Extensions -&amp;gt; Extension Manager -&amp;gt; Discover (i.e. the Discover &#039;&#039;tab&#039;&#039;). Click &#039;&#039;&#039;Discover&#039;&#039;&#039; (i.e. the Discover &#039;&#039;button&#039;&#039;) to discover your template, then select it and click &#039;&#039;&#039;Install&#039;&#039;&#039; to install it. Now your template should show up in the [[Help16:Extensions_Template_Manager_Styles|Template Manager (Styles)]], accessible via Extensions -&amp;gt; Template Manager.&lt;br /&gt;
&lt;br /&gt;
Note you can create your template outside of Joomla and simply install it like any regular extension.&lt;br /&gt;
&lt;br /&gt;
HINT: there are a couple of ways you can preview your index page as you put it together, either insert the styles into the head of the index page or directly link it to the style sheet you will be using temporarily. You can remove these links before packaging the file.&lt;br /&gt;
&lt;br /&gt;
== Packaging the template for installation ==&lt;br /&gt;
{{:Packaging_a_extension}}&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
&lt;br /&gt;
You should now have created a template that works. It won&#039;t look like much yet. The best thing to do now is start experimenting with the layout.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Templates]]&lt;br /&gt;
[[Category:Tutorials]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Editor_form_field_type&amp;diff=193253</id>
		<title>Editor form field type</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Editor_form_field_type&amp;diff=193253"/>
		<updated>2015-06-18T09:30:58Z</updated>

		<summary type="html">&lt;p&gt;Flimm: /* See also */ Fixed broken link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Editor&#039;&#039;&#039; field type provides a WYSIWYG editor.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;type&#039;&#039;&#039; (mandatory) must be &#039;&#039;editor&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;name&#039;&#039;&#039; (mandatory) is the unique name of the parameter.&lt;br /&gt;
* &#039;&#039;&#039;label&#039;&#039;&#039; (mandatory) (translatable) is the descriptive title of the field.&lt;br /&gt;
* &#039;&#039;&#039;width&#039;&#039;&#039; (optional) defines the width (in pixels) of the wysiwyg editor and defaults to 100%.&lt;br /&gt;
* &#039;&#039;&#039;height&#039;&#039;&#039; (optional) defines the height (in pixels) of the wysiwyg editor and defaults to 250px.&lt;br /&gt;
* &#039;&#039;&#039;cols&#039;&#039;&#039; (optional) defines the width of the editor (in columns).&lt;br /&gt;
* &#039;&#039;&#039;rows&#039;&#039;&#039; (optional) defines the height of the editor (in rows).&lt;br /&gt;
* &#039;&#039;&#039;buttons&#039;&#039;&#039; (optional) can be an array of plugin buttons to be excluded or set to false. The default editors-xtd are: article, image, pagebreak and readmore.&lt;br /&gt;
* &#039;&#039;&#039;hide&#039;&#039;&#039; (optional) array of plugin buttons to be hidden. eg... set buttons=&amp;quot;true&amp;quot; hide=&amp;quot;readmore,pagebreak&amp;quot;&lt;br /&gt;
* &#039;&#039;&#039;editor&#039;&#039;&#039; specifies the editor to be used and can include two options (editor=&amp;quot;desired|alternative&amp;quot;)&lt;br /&gt;
* &#039;&#039;&#039;filter&#039;&#039;&#039; (optional) allow the system to save certain html tags or raw data.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example XML Definition&lt;br /&gt;
&amp;lt;source lang=&amp;quot;xml&amp;quot;&amp;gt;&amp;lt;field name=&amp;quot;test1&amp;quot; label =&amp;quot;Test Field&amp;quot; type=&amp;quot;editor&amp;quot; width=&amp;quot;300&amp;quot; filter=&amp;quot;safehtml&amp;quot; /&amp;gt;&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See also ===&lt;br /&gt;
* [[Textarea form field type]]&lt;br /&gt;
* [[Standard form field types|Table of all standard form field types]]&lt;br /&gt;
[[Category:Standard form field types]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=Packaging_a_extension&amp;diff=192334</id>
		<title>Packaging a extension</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=Packaging_a_extension&amp;diff=192334"/>
		<updated>2015-06-16T15:22:38Z</updated>

		<summary type="html">&lt;p&gt;Flimm: There&amp;#039;s no need to provide the -a to zip&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A directory with several loose files is not a convenient package for distribution. So the final step is to make a &#039;&#039;package&#039;&#039;. This is a compressed archive containing the directory structure and all the files. The package can be in &#039;&#039;&#039;ZIP&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.zip&amp;lt;/tt&amp;gt; extension), in &#039;&#039;&#039;TAR-gzip&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.tar.gz&amp;lt;/tt&amp;gt; extension), or in &#039;&#039;&#039;TAR-bz2&#039;&#039;&#039; format (with a &amp;lt;tt&amp;gt;.tar.bz2&amp;lt;/tt&amp;gt; extension). &lt;br /&gt;
&lt;br /&gt;
If your template is in a directory &amp;lt;tt&amp;gt;mytemplate/&amp;lt;/tt&amp;gt; then to make the package you can connect to that directory and use commands like:&lt;br /&gt;
* &amp;lt;tt&amp;gt;tar cvvzf ../mytemplate.tar.gz *&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;zip -r ..\mytemplate.zip *.*&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Note to Mac OS X users ===&lt;br /&gt;
Note to template developers using Mac OS X systems: the Finder&#039;s &amp;quot;compress&amp;quot; menu item produces a usable ZIP format package, but with one catch. It stores the files in [[AppleDouble]] format, adding extra files with names beginning with &amp;quot;&amp;lt;tt&amp;gt;._&amp;lt;/tt&amp;gt;&amp;quot;. Thus it adds a file named &amp;quot;&amp;lt;tt&amp;gt;._templateDetails.xml&amp;lt;/tt&amp;gt;, which Joomla 1.5.x can sometimes misinterpret. The symptom is an error message, &amp;quot;XML Parsing Error at 1:1. Error 4: Empty document&amp;quot;. The workaround is to compress from the command line, and set a shell environment variable &amp;quot;COPYFILE_DISABLE&amp;quot; to &amp;quot;true&amp;quot; before using &amp;quot;compress&amp;quot; or &amp;quot;tar&amp;quot;. See the [http://en.wikipedia.org/wiki/AppleSingle_and_AppleDouble_formats AppleDouble] article for more information.&lt;br /&gt;
&lt;br /&gt;
To set an environment variable on a Mac, open a terminal window and type:&lt;br /&gt;
 export COPYFILE_DISABLE=true&lt;br /&gt;
&lt;br /&gt;
Then in the same terminal window, change directories into where your template files reside and issue the zip command.  For instance, if your template files have been built in a folder in your personal directory called myTemplate, then you would do the following:&lt;br /&gt;
 cd myTemplate&lt;br /&gt;
 zip -r myTemplate.zip *&lt;br /&gt;
&lt;br /&gt;
[[Category:Extension development]]&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=J3.x:Adding_JavaScript_and_CSS_to_the_page&amp;diff=182630</id>
		<title>J3.x:Adding JavaScript and CSS to the page</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=J3.x:Adding_JavaScript_and_CSS_to_the_page&amp;diff=182630"/>
		<updated>2015-05-22T11:56:30Z</updated>

		<summary type="html">&lt;p&gt;Flimm: Add links to API and more details about minification&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{notice|The API of the JHtml::script() and JHtml::stylesheet() method changed after Joomla 1.5 - it worked but was deprecated in Joomla 2.5 and support for the old API was removed in Joomla 3.x|title=API Change}}&lt;br /&gt;
&lt;br /&gt;
== Inserting from a File ==&lt;br /&gt;
To have a well-formed HTML document, you must put all references to Javascript and CSS files within the &amp;lt;code&amp;gt;&amp;lt;head&amp;gt;&amp;lt;/code&amp;gt; portion. Since Joomla! generates all the HTML that makes up a page before output, it is possible to add these references within the &amp;lt;head&amp;gt; tags from your extension. The simplest way to do this is to make use of the functionality built in to Joomla!&lt;br /&gt;
&lt;br /&gt;
===JDocument===&lt;br /&gt;
This is a much less flexible option. However it is more efficient for a large number of scenarios such as including a stylesheet in a template. Of course, you will also need to manually code some of the steps that would be done automatically using the JHtml method below.&lt;br /&gt;
&lt;br /&gt;
First, get a reference to the current document object:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$document = JFactory::getDocument();&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then for a stylesheet, use this code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$document-&amp;gt;addStyleSheet($url);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To add a Javascript file, use this code:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$document-&amp;gt;addScript($url);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;$url&amp;lt;/code&amp;gt; is the variable containing the full path to the javascript or CSS file for example:&lt;br /&gt;
&amp;lt;code&amp;gt;JUri::base() . &#039;templates/custom/js/sample.js&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note this will **NOT** include Mootools or jQuery. If your script requires Mootools or jQuery see [[Javascript_Frameworks]] for full details on how to include them (note jQuery can only be included natively on Joomla 3.0+).&lt;br /&gt;
&lt;br /&gt;
===JHtml===&lt;br /&gt;
JHtml offers much more flexibility than JDocument, whilst using the same base functionality - indeed at the end of the day JHtml will call &amp;lt;code&amp;gt;JFactory::getDocument()-&amp;gt;addStyleSheet()&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;JFactory::getDocument()-&amp;gt;addScript()&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If you wish to just include a straight file path, in a template for example, then you are better using JDocument. However if you wish to take into account whether debug is enabled to include a compressed script or take advantage of template overridable scripts and stylesheets then using JHtml is generally better. It is recommended all 3rd Party Developers use JHtml to allow template overrides of their CSS and javascript for template designers.&lt;br /&gt;
&lt;br /&gt;
====JHtml::script====&lt;br /&gt;
&lt;br /&gt;
The following is the signature of this function, you can see more at [https://api.joomla.org/cms-3/classes/JHtml.html#method_script JHtml::script on api.joomla.org]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
script(string $file, boolean $framework = false, boolean $relative = false, boolean $path_only = false, boolean $detect_browser = true, boolean $detect_debug = true) : mixed&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using JHtml to include a javascript file can bring you several benefits. The first of these is if your javascript file has a mootools dependency then you can automatically include it by setting the second parameter of this method to true as below&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
JHtml::script(JUri::base() . &#039;templates/custom/js/sample.js&#039;, true);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The third parameter of this method allows template overridable javascript files to allow greater customization of extensions. The first parameter is now assumes you are starting in the &amp;lt;code&amp;gt;JPATH_BASE/media&amp;lt;/code&amp;gt; folder - within here you specify your extension name followed by the name of your javascript file. The path searched is then &amp;lt;code&amp;gt;JPATH_BASE/media/com_search/js/search.js&amp;lt;/code&amp;gt; for the following JHtml snippet&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
JHtml::script(&#039;com_search/search.js&#039;, false, true);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the js subdirectory that is searched in the com_search directory shouldn&#039;t be specified in the JHtml method.&lt;br /&gt;
&lt;br /&gt;
However on top of this if a file exists in &amp;lt;code&amp;gt;js/com_search/search.js&amp;lt;/code&amp;gt; then this will be included instead. For example say a extension has a mootools dependent file but the user only wants jQuery to be loaded. This means that a user could override the file with a jQuery version.&lt;br /&gt;
&lt;br /&gt;
By default Joomla will automatically include a compressed and uncompressed version of any scripts depending on whether debug mode is turned off or on. Call your compressed script search.min.js and the uncompressed version script-uncompressed.js or script.js to use this functionality and aid with debugging of any scripts. You should call the function with the compressed version, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
JHtml::script(&#039;com_search/search.min.js&#039;);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Furthermore you can include browser specific files. Joomla can look for the files of the following types&lt;br /&gt;
* filename.ext&lt;br /&gt;
* filename_browser.ext&lt;br /&gt;
* filename_browser_major.ext&lt;br /&gt;
* filename_browser_major_minor.ext&lt;br /&gt;
&lt;br /&gt;
This can allow you to include internet explorer 6 specific files for example. By having a search.js for general use with a search_msie_6.js for a file with extra internet explorer 6 fixes.&lt;br /&gt;
&lt;br /&gt;
====JHtml::stylesheet====&lt;br /&gt;
&lt;br /&gt;
The following is the signature of this function, you can see more at [https://api.joomla.org/cms-3/classes/JHtml.html#method_stylesheet JHtml::stylesheet on api.joomla.org]:&lt;br /&gt;
&lt;br /&gt;
Using JHtml to include a CSS file can bring you several benefits. The first of these is allowing template overridable CSS files to allow greater customization of extensions. Setting the third parameter to true now assumes you are starting in the &amp;lt;code&amp;gt;JPATH_BASE/media&amp;lt;/code&amp;gt; folder - within here you specify your extension name followed by the name of your CSS file. The path searched is then &amp;lt;code&amp;gt;JPATH_BASE/media/com_search/css/search.css&amp;lt;/code&amp;gt; for the following JHtml snippet&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
JHtml::stylesheet(&#039;com_search/search.css&#039;, array(), true);&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;css&amp;lt;/code&amp;gt; subdirectory that is searched in the &amp;lt;code&amp;gt;com_search&amp;lt;/code&amp;gt; directory shouldn&#039;t be specified in the JHtml method.&lt;br /&gt;
&lt;br /&gt;
However on top of this if a file exists in &amp;lt;code&amp;gt;css/com_search/search.css&amp;lt;/code&amp;gt; then this will be included instead. This allows people to customize the appearance of an extension to better match their templates styling.&lt;br /&gt;
&lt;br /&gt;
Furthermore you can include browser specific files. Joomla can look for the files of the following types&lt;br /&gt;
* filename.ext&lt;br /&gt;
* filename_browser.ext&lt;br /&gt;
* filename_browser_major.ext&lt;br /&gt;
* filename_browser_major_minor.ext&lt;br /&gt;
&lt;br /&gt;
This can allow you to include internet explorer 6 specific files for example. By having a search.css for general use with a search_msie_6.css for a file with extra internet explorer 6 fixes.&lt;br /&gt;
&lt;br /&gt;
Similarly as with JHtml::script, if $detect_debug is true and you pass it a minified stylesheet example.min.css, when debug mode is on, the unminified stylesheet will be used instead, if it exists. &lt;br /&gt;
&lt;br /&gt;
== Inserting inline scripts from within a PHP file ==&lt;br /&gt;
If your Javascript or CSS are generated using PHP, you can add the script or stylesheet directly into the head of your document:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$document = JFactory::getDocument();&lt;br /&gt;
&lt;br /&gt;
// Add Javascript&lt;br /&gt;
$document-&amp;gt;addScriptDeclaration(&#039;&lt;br /&gt;
    window.event(&amp;quot;domready&amp;quot;, function() {&lt;br /&gt;
        alert(&amp;quot;An inline JavaScript Declaration&amp;quot;);&lt;br /&gt;
    });&lt;br /&gt;
&#039;);&lt;br /&gt;
&lt;br /&gt;
// Add styles&lt;br /&gt;
$style = &#039;body {&#039;&lt;br /&gt;
        . &#039;background: #00ff00;&#039;&lt;br /&gt;
        . &#039;color: rgb(0,0,255);&#039;&lt;br /&gt;
        . &#039;}&#039;; &lt;br /&gt;
$document-&amp;gt;addStyleDeclaration($style);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Javascript Example ===&lt;br /&gt;
For example, the following code is used to define a custom tool tip that takes advantage of mootools.&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
function getToolTipJS($toolTipVarName, $toolTipClassName){&lt;br /&gt;
    $javascript = &#039;window.addEvent(\&amp;quot;domready\&amp;quot;, function(){&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t&amp;quot;  .&#039;var $toolTipVarName = new Tips($$(&amp;quot;&#039; . $toolTipVarName .&#039;&amp;quot;), {&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;className: &amp;quot;&#039; .$toolTipClassName .&#039;&amp;quot;,&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;initialize: function(){&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t\t&amp;quot;    .&#039;this.fx = new Fx.Style(this.toolTip, &amp;quot;opacity&amp;quot;, {duration: 500, wait: false}).set(0);&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;},&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;onShow: function(toolTip){&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t\t&amp;quot;    .&#039;this.fx.start(1);&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;},&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;onHide: function(toolTip) {&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t\t&amp;quot;    .&#039;this.fx.start(0);&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t\t&amp;quot;   .&#039;}&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &amp;quot;\t&amp;quot;  .&#039;});&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
    $javascript .= &#039;});&#039; .&amp;quot;\n\n&amp;quot;;&lt;br /&gt;
    return $javascript;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
$document = JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addStyleSheet(&amp;quot;/joomla/components/com_mycustomcomponent/css/mytooltip.css&amp;quot;,&#039;text/css&#039;,&amp;quot;screen&amp;quot;);&lt;br /&gt;
$document-&amp;gt;addScriptDeclaration(getToolTipJS(&amp;quot;mytool&amp;quot;,&amp;quot;MyToolTip&amp;quot;));&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Note that in order for this Javascript to be functionally useful, it would be necessary to include the appropriate class name in the HTML, as well as providing the &amp;lt;code&amp;gt;mytooltip.css&amp;lt;/code&amp;gt; file. Both are outside the scope of this article.&lt;br /&gt;
&lt;br /&gt;
=== CSS Examples ===&lt;br /&gt;
This is also useful if your inserting a form field of CSS into your code. For example in a module, you might want a user to choose to call the colour of the border. After calling the form fields value and assigning it a variable $bordercolor in mod_example.php. Then in tmpl/default.php you can include the following&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$document = JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addStyleSheet(&#039;mod_example/mod_example.css&#039;, array(), true);&lt;br /&gt;
$style = &#039;#example {&lt;br /&gt;
	border-color:#&#039; . $bordercolor . &#039;;&lt;br /&gt;
	}&#039;;&lt;br /&gt;
$document-&amp;gt;addStyleDeclaration( $style );&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
Here mod_example.css contains the CSS file of any non-parameter based styles. Then the bordercolor parameter/form field is added in separately&lt;br /&gt;
&lt;br /&gt;
==Add Custom Tag==&lt;br /&gt;
There will be some occasions where even these functions are not flexible enough, as they are limited to writing the contents of &amp;lt;code&amp;gt;&amp;lt;script /&amp;gt;&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;&amp;lt;style /&amp;gt;&amp;lt;/code&amp;gt; tags, and cannot add anything outside those tags. One example would be the inclusion of a stylesheet link within conditional comments, so that it is picked up only by Internet Explorer 6 and earlier. To do this, use &amp;lt;code&amp;gt;$document-&amp;gt;addCustomTag&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;source lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
$stylelink = &#039;&amp;lt;!--[if lte IE 6]&amp;gt;&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
$stylelink .= &#039;&amp;lt;link rel=&amp;quot;stylesheet&amp;quot; href=&amp;quot;../css/IEonly.css&amp;quot; /&amp;gt;&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
$stylelink .= &#039;&amp;lt;![endif]--&amp;gt;&#039; .&amp;quot;\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
$document = JFactory::getDocument();&lt;br /&gt;
$document-&amp;gt;addCustomTag($stylelink);&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Development]] [[Category:Tutorials]][[Category:Component Development]][[Category:Module Development]] [[Category:JavaScript]] [[Category:CSS]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
	<entry>
		<id>https://docs.sandbox.joomla.org/index.php?title=User:Flimm&amp;diff=182627</id>
		<title>User:Flimm</title>
		<link rel="alternate" type="text/html" href="https://docs.sandbox.joomla.org/index.php?title=User:Flimm&amp;diff=182627"/>
		<updated>2015-05-22T11:18:22Z</updated>

		<summary type="html">&lt;p&gt;Flimm: Created page with &amp;quot;Experienced developer but a beginner at Joomla.  Joomla StackExchange profile: joomla.stackexchange.com/users/5239/flimm  Stack Overflow profile: stackoverflow.com/users/24769...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Experienced developer but a beginner at Joomla.&lt;br /&gt;
&lt;br /&gt;
Joomla StackExchange profile: joomla.stackexchange.com/users/5239/flimm&lt;br /&gt;
&lt;br /&gt;
Stack Overflow profile: stackoverflow.com/users/247696/flimm&lt;/div&gt;</summary>
		<author><name>Flimm</name></author>
	</entry>
</feed>