Development Best Practices
From Joomla! Documentation
Revision as of 08:31, 29 October 2013 by Wilsonge
This article is tagged because it NEEDS IMPROVEMENT. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.
Reason: It is severely outdated and needs a major revision.
|It has been suggested that this article or section be split into multiple pages. Reason: Would this be better split into FAQ type page? Otherwise I suggest deletion. (Click to discuss) this split suggestion. If split is not obvious, please allow split request to remain for 1 week pending discussions. (Purge)|
General Development Guidelines
- Don't use the DS or DIRECTORY_SEPARATOR constant when including files. It is no longer needed, as pointed out by Christian on php.net
- Don't depend on register_globals. This is a HIGH security risk, and the feature has been deprecated in PHP 5.3 and removed in 5.4.
You can see in your root a general media folder to hold all assets.
What this means in real terms is that when in your xml install manifest, if you put files insite a <media> tag instead of a <files> tag then they will be sent to the JPATH_ROOT/media folder. If you give it <media destination="com_foo"> then it will put the files in JPATH_ROOT/media/com_foo
In some cases you have a component, we'll say com_foo, and then you have a few modules that go along with com_foo... for sake of the example we'll call them mod_foo_1, mod_foo_2 and mod_foo_3. There is no reason to package media elements for the three modules if they are all the same and they depend upon the component anyway. The best and most logical way to do things is to put them all in a central place that is namespaced appropriately.