<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Helion-Prime Solutions blog &#187; joomla</title>
	<atom:link href="http://blogs.helion-prime.com/category/cms-general/joomla/feed" rel="self" type="application/rss+xml" />
	<link>http://blogs.helion-prime.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 10 May 2010 17:51:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Battle N2: Typo3, Joomla!, and Drupal CMSs performance testing</title>
		<link>http://blogs.helion-prime.com/2008/07/02/battle-n2-typo3-joomla-and-drupal-cmss-performance-testing.html</link>
		<comments>http://blogs.helion-prime.com/2008/07/02/battle-n2-typo3-joomla-and-drupal-cmss-performance-testing.html#comments</comments>
		<pubDate>Wed, 02 Jul 2008 08:34:55 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=39</guid>
		<description><![CDATA[“More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason &#8211; including blind stupidity.”
William A. Wulf
preamble
Since my last article about performance comparison of popular CMSs: Typo3, Joomla!, and Drupal [typo3-joomla-and-drupal-cmss-performance-testing.html] I got enormous amount of messages, emails and notes.
Most discussed question is:
*What the hell you [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>“More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason &#8211; including blind stupidity.”<br />
William A. Wulf</p></blockquote>
<h2>preamble</h2>
<p>Since my last article about performance comparison of popular CMSs: Typo3, Joomla!, and Drupal [<a href="http://blogs.helion-prime.com/alexshapovalov/2008/05/19/typo3-joomla-and-drupal-cmss-performance-testing.html">typo3-joomla-and-drupal-cmss-performance-testing.html</a>] I got enormous amount of messages, emails and notes.</p>
<p>Most discussed question is:<br />
<span style="color: #3366ff;">*</span>What the hell you didn&#8217;t turn cache on, and forgot about optimization?</p>
<p><strong>And comments like:</strong><br />
In case of optimization zzz will take first place.<br />
No one runs systems like that in real life. Every real web server is optimized for performance ..</p>
<p><strong>I answered several times with:</strong><br />
I make tests to test effectiveness of pure systems rather then caching sub-system or optimization methods.<br />
Developers should think about effectiveness of their components and don’t pass care about performance entirely to caching or other technics.<br />
Surely cache is good as well as better CPU, bandwidth, and cluster when solution is already got all benefits of good software design.</p>
<p><em>But if you want OK.<br />
I will turn ON everything I know on all CMSs, and will make all environment optimizations. I hope you will be glad.</em></p>
<p>Surely if you are hacker that want to tune all the daylights you will beat any system.<br />
Let&#8217;s think that this environment presents common set of optimizations on general production system.</p>
<h2>Prepared configuration</h2>
<p>architecture: x86<br />
CPU: 3.0Ghz<br />
RAM: 512Mb<br />
OS: Debian GNU/Linux lenny/sid (testing)<br />
kernel: 2.6.22, optimized for current computer configuration</p>
<p><strong>software versions:</strong><br />
apache: 2.2.8<br />
php: 5.2.5-3<br />
mysql: 5.0.51a-3</p>
<p>joomla!: 1.5.3<br />
drupal: 6.2<br />
typo3: 4.2.1</p>
<p><strong>apache:</strong><br />
web-server API: apache2.0 handler<br />
processing model: mpm-prefork [http://httpd.apache.org/docs/2.0/mod/prefork.html]<br />
MaxClient  adapted for load<br />
excessive login disabled<br />
HostNameLookups dissabled</p>
<p><strong>PHP:</strong><br />
XCache PHP opcode cacher installed [http://xcache.lighttpd.net/]</p>
<p>xcache.cacher = On<br />
xcache.optimizer = On<br />
xcache.coverager = Off</p>
<p>xcache.size=64M # cache size<br />
xcache.count=2 # cpu count</p>
<p>xcache.var_size = 64M # variable data cache size<br />
xcache.var_count = 2 # cpu count</p>
<p><strong>MySQL:</strong><br />
mysqli database adapter used  where appropriate<br />
bin log disabled<br />
query_cache_limit = 2M # default was 1M<br />
query_cache_size = 64M # default was 16M<br />
table_cache = 256 # default was 64<br />
key_buffer_size = 64M # default was 16M</p>
<p>CMSs returned specially prepared page contains:<br />
menu, login form, 2 articles with overall size 40Kb<br />
Testing series contains results for 10, and 20 simultaneous users.</p>
<h2>comparison results</h2>
<p><strong>note: </strong><br />
results in the tables are presented in milliseconds per page request<br />
and surely smaller result is better.</p>
<p><strong>10 users</strong></p>
<table style="border-color: gray; border-style: dotted; width:450px;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td><strong>joomla</strong></td>
<td><strong>drupal</strong></td>
<td><strong>typo3</strong></td>
</tr>
<tr>
<td><strong>average</strong></td>
<td>101</td>
<td>19</td>
<td>71</td>
</tr>
<tr>
<td><strong>median</strong></td>
<td>100</td>
<td>18</td>
<td>71</td>
</tr>
<tr>
<td><strong>90% results line</strong></td>
<td>145</td>
<td>30</td>
<td>103</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>19</td>
<td>8</td>
<td>16</td>
</tr>
<tr>
<td><strong>max</strong></td>
<td>289</td>
<td>60</td>
<td>570</td>
</tr>
</tbody>
</table>
<p><img class="alignnone size-full wp-image-42" title="results_10u1" src="http://blogs.helion-prime.com/wp-content/uploads/2008/07/results_10u1.jpg" alt="" width="370" height="276" /></p>
<p><strong>20 users</strong></p>
<table style="border-color: gray; border-style: dotted; width:450px;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td><strong>joomla</strong></td>
<td><strong>drupal</strong></td>
<td><strong>typo3</strong></td>
</tr>
<tr>
<td><strong>average</strong></td>
<td>237</td>
<td>47</td>
<td>187</td>
</tr>
<tr>
<td><strong>median</strong></td>
<td>196</td>
<td>41</td>
<td>146</td>
</tr>
<tr>
<td><strong>90% results line</strong></td>
<td>357</td>
<td>72</td>
<td>318</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>18</td>
<td>8</td>
<td>16</td>
</tr>
<tr>
<td><strong>max</strong></td>
<td>7323</td>
<td>356</td>
<td>4378</td>
</tr>
</tbody>
</table>
<p><img class="alignnone size-full wp-image-43" title="results_20u1" src="http://blogs.helion-prime.com/wp-content/uploads/2008/07/results_20u1.jpg" alt="" width="371" height="277" /></p>
<p><strong>fast conclusion:</strong><br />
Drupal uses caching mechanism more effectively that explains such lag of others.<br />
Numbers, and graphs are very loud, and so I think you don&#8217;t need any additional descriptions.</p>
<p>You can always compare this result with result without optimization techniques using my previous article [<a href="http://blogs.helion-prime.com/alexshapovalov/2008/05/19/typo3-joomla-and-drupal-cmss-performance-testing.html">typo3-joomla-and-drupal-cmss-performance-testing.html</a>].</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2008/07/02/battle-n2-typo3-joomla-and-drupal-cmss-performance-testing.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Typo3, Joomla!, and Drupal CMSs performance testing</title>
		<link>http://blogs.helion-prime.com/2008/05/19/typo3-joomla-and-drupal-cmss-performance-testing.html</link>
		<comments>http://blogs.helion-prime.com/2008/05/19/typo3-joomla-and-drupal-cmss-performance-testing.html#comments</comments>
		<pubDate>Mon, 19 May 2008 11:16:09 +0000</pubDate>
		<dc:creator>alex.shapovalov</dc:creator>
				<category><![CDATA[drupal]]></category>
		<category><![CDATA[joomla]]></category>
		<category><![CDATA[typo3]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=12</guid>
		<description><![CDATA[preamble
Our company above all uses 3 CMSs [http://en.wikipedia.org/wiki/Content_management_system]
Typo3, Joomla!, and Drupal since we find them the most appropriate for most of our tasks.
Check this our article to find more about it [cms-based-web-applications-fast-way-for-creation-of-web-based-solutions.html]
Sometimes our customers asks what is faster, trying to find fair answer I made a short research
in order to compare them and provide our [...]]]></description>
			<content:encoded><![CDATA[<h2>preamble</h2>
<p>Our company above all uses 3 CMSs [<a href="http://en.wikipedia.org/wiki/Content_management_system">http://en.wikipedia.org/wiki/Content_management_system</a>]<br />
Typo3, Joomla!, and Drupal since we find them the most appropriate for most of our tasks.<br />
Check this our article to find more about it [<a href="http://blogs.helion-prime.com/vasiliykiryanov/2008/05/07/cms-based-web-applications-fast-way-for-creation-of-web-based-solutions.html">cms-based-web-applications-fast-way-for-creation-of-web-based-solutions.html</a>]</p>
<p>Sometimes our customers asks what is faster, trying to find fair answer I made a short research<br />
in order to compare them and provide our customer as well as you with pretty graphs.</p>
<h2>testing conditions</h2>
<p>I have created virtual dedicated server with following configuration within our server<br />
to have a picture of average hosting providers.</p>
<p><strong>configuration:</strong><br />
architecture: 	x86<br />
CPU:		3.0Ghz<br />
RAM:		512Mb<br />
OS:		Debian GNU/Linux lenny/sid (testing)<br />
kernel:		2.6.22-3-686</p>
<p>On all CMS returned page contains:<br />
menu, login form, 2 articles with overall size 40Kb</p>
<p>As Joomla! doesn&#8217;t have built-in internationalization functionality I made tests with JoomFish 2.0beta extension<br />
that provide that functionality and without it.</p>
<p>Every testing series contains results for 1, 10, and 20 simultaneous users.<br />
Caching functionally:<br />
turned off for Drupal, Joomla!, and Typo3;</p>
<p><strong>apache configuration:</strong><br />
apache web-server API: apache2.0 handler<br />
processing model: mpm-prefork [http://httpd.apache.org/docs/2.0/mod/prefork.html]</p>
<p><strong>software versions:</strong><br />
apache: 2.2.8<br />
php: 5.2.5-3<br />
mysql: 5.0.51a-3</p>
<p>joomla!: 1.5.2<br />
typo3: 4.1.6<br />
drupal:6.2</p>
<h2>comparison results</h2>
<p>So it&#8217;s time to see some results. Keep your eyes widely opened..</p>
<p><em>note: </em><br />
results in the tables are presented in milliseconds per page request<br />
and surely smaller result is better</p>
<p><strong>1 user</strong></p>
<table style="border-color: lightgrey; border-style: dotted; width:450px;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td><strong>joomla+joomfish</strong></td>
<td><strong>joomla</strong></td>
<td><strong>drupal</strong></td>
<td><strong>typo3</strong></td>
</tr>
<tr>
<td><strong>average</strong></td>
<td>261</td>
<td>185</td>
<td>130</td>
<td>233</td>
</tr>
<tr>
<td><strong>median</strong></td>
<td>260</td>
<td>184</td>
<td>129</td>
<td>232</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>253</td>
<td>180</td>
<td>127</td>
<td>225</td>
</tr>
<tr>
<td><strong>max</strong></td>
<td>311</td>
<td>209</td>
<td>144</td>
<td>248</td>
</tr>
</tbody>
</table>
<p><img class="alignnone size-full wp-image-13" title="1user" src="http://blogs.helion-prime.com/wp-content/uploads/2008/05/1user.jpg" alt="" width="460" height="265" /></p>
<p><strong>10 users</strong></p>
<table style="border-color: lightgrey; border-style: dotted; width:450px;"  cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td><strong>joomla+joomfish</strong></td>
<td><strong>joomla</strong></td>
<td><strong>drupal</strong></td>
<td><strong>typo3</strong></td>
</tr>
<tr>
<td><strong>average</strong></td>
<td>2093</td>
<td>1510</td>
<td>1118</td>
<td>2039</td>
</tr>
<tr>
<td><strong>median</strong></td>
<td>1965.5</td>
<td>1416</td>
<td>1040</td>
<td>1247.5</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>253</td>
<td>181</td>
<td>126</td>
<td>226</td>
</tr>
<tr>
<td><strong>max</strong></td>
<td>36422</td>
<td>31591</td>
<td>30999</td>
<td>29138</td>
</tr>
</tbody>
</table>
<p><img class="alignnone size-full wp-image-15" title="10users" src="http://blogs.helion-prime.com/wp-content/uploads/2008/05/10users.jpg" alt="" width="460" height="265" /></p>
<p><strong>20 users</strong></p>
<table style="border-color: lightgrey; border-style: dotted; width:450px;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td></td>
<td><strong>joomla+joomfish</strong></td>
<td><strong>joomla</strong></td>
<td><strong>drupal</strong></td>
<td><strong>typo3</strong></td>
</tr>
<tr>
<td><strong>average</strong></td>
<td>4106</td>
<td>2908</td>
<td>2123</td>
<td>3886</td>
</tr>
<tr>
<td><strong>median</strong></td>
<td>3689</td>
<td>2306</td>
<td>1552</td>
<td>2075</td>
</tr>
<tr>
<td><strong>min</strong></td>
<td>254</td>
<td>182</td>
<td>128</td>
<td>233</td>
</tr>
<tr>
<td><strong>max</strong></td>
<td>119187</td>
<td>112612</td>
<td>83831</td>
<td>105285</td>
</tr>
</tbody>
</table>
<p><img class="alignnone size-full wp-image-16" title="20users" src="http://blogs.helion-prime.com/wp-content/uploads/2008/05/20users.jpg" alt="" width="460" height="265" /></p>
<h2>fast conclusions:</h2>
<p>as you see in the tables and on graphs</p>
<p><span style="color: #3366ff;">**</span>Drupal is noticeably faster then competitors<br />
<span style="color: #3366ff;">**</span>joomfish is a break for Joomla but it is very important extension and very likely it is installed on your system<br />
<span style="color: #3366ff;">**</span>without JoomFish Joomla! can be even faster then Typo3</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2008/05/19/typo3-joomla-and-drupal-cmss-performance-testing.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Joomla! 1.5 extensions development hints</title>
		<link>http://blogs.helion-prime.com/2008/05/12/joomla-15-extensions-development-hints.html</link>
		<comments>http://blogs.helion-prime.com/2008/05/12/joomla-15-extensions-development-hints.html#comments</comments>
		<pubDate>Mon, 12 May 2008 13:38:10 +0000</pubDate>
		<dc:creator>henadiy.atroshko</dc:creator>
				<category><![CDATA[joomla]]></category>
		<category><![CDATA[joomla development]]></category>

		<guid isPermaLink="false">http://blogs.helion-prime.com/?p=11</guid>
		<description><![CDATA[0. go through basic Joomla! documentation
Joomla! Beginners guide: [http://docs.joomla.org/Beginners]
Joomla developer network: [http://dev.joomla.org/]
which includes very useful:
Joomla framework API: [http://api.joomla.org/]
Joomla! tutorials on Wiki: [http://dev.joomla.org/component/option,com_jd-wiki/Itemid,32/]
Joomla! forum: [http://forum.joomla.org]
1. project structure
It is useful during development to keep the code in only one place. You can easy use this structure with your IDEs [http://en.wikipedia.org/wiki/Integrated_development_environment] and VCS [http://en.wikipedia.org/wiki/Version_control_system]
It is recommended to use [...]]]></description>
			<content:encoded><![CDATA[<h2>0. go through basic Joomla! documentation</h2>
<p>Joomla! Beginners guide: [<a href="http://docs.joomla.org/Beginners">http://docs.joomla.org/Beginners</a>]</p>
<p>Joomla developer network: [<a href="http://dev.joomla.org/">http://dev.joomla.org/</a>]<br />
which includes very useful:<br />
Joomla framework API: [http://api.joomla.org/]<br />
Joomla! tutorials on Wiki: [http://dev.joomla.org/component/option,com_jd-wiki/Itemid,32/]</p>
<p>Joomla! forum: [<a href="http://forum.joomla.org">http://forum.joomla.org</a>]</p>
<h2>1. project structure</h2>
<p>It is useful during development to keep the code in only one place. You can easy use this structure with your IDEs [<a href="http://en.wikipedia.org/wiki/Integrated_development_environment">http://en.wikipedia.org/wiki/Integrated_development_environment</a>] and VCS [<a href="http://en.wikipedia.org/wiki/Version_control_system">http://en.wikipedia.org/wiki/Version_control_system</a>]</p>
<p>It is recommended to use next structure:</p>
<pre>project-root
	com_component
		site
			...
			lang
				...
				en-GB.com_component.ini
				de-DE.com_component.ini
			component.php
		admin
			...
			lang
				...
				en-GB.com_component.ini
				de-DE.com_component.ini
			admin.component.php
			install.sql
			uninstall.sql
		component.xml
	mod_module
		...
		lang
			...
			en-GB.mod_module.ini
			de-DE.mod_module.ini
		module.php
		module.xml
	plg_plugin
		...
		lang
			...
			en-GB.plg_group_plugin.ini
			de-DE.plg_group_plugin.ini
		plugin.php
		plugin.xml
	tpl_temlate
		template.xml
	...
</pre>
<p>After creation of project structure prepare installation packages with help of Joomla! tutorials and install them to Joomla!. We will work with local installation (or dedicated server in your LAN) because another variants decries performance of developers.</p>
<p>After extensions installation process change files of extensions installed to Joomla! with GNU/Linux symbolic links [<a href="http://en.wikipedia.org/wiki/Symbolic_link">http://en.wikipedia.org/wiki/Symbolic_link</a>] or Windows Vista symbolic links [<a href="http://en.wikipedia.org/wiki/NTFS_symbolic_link">http://en.wikipedia.org/wiki/NTFS_symbolic_link</a>] of your project files.<br />
Note: Don&#8217;t forget to use option “Options +FollowSymLinks” for Apache web-server for directory where your Joomla! installed to use symbolic links.</p>
<p>In Joomla! filenames of extensions has special structure. In mentioned structure names of corresponding extensions in filenames  and directories replaced with words component, module, and plug-in. The word group in files of plugin replaces name of group to which plug-in relate to [content, editors, search, system, user].<br />
Every group defines set of events on which plug-in will be triggered.</p>
<p>Ready to use project has following structure of relations: (&lt;== symbol means symbolic link)</p>
<pre>PRJ-ROOT/COM_COMPONENT/SITE &lt;== J_ROOT/COMPONENTS/COM_COMPONET
PRJ-ROOT/COM_COMPONENT/SITE/LANG/en-GB.com_component.ini
&lt;== J_ROOT/LANGUAGE/en-GB/en-GB.com_component.ini
PRJ-ROOT/COM_COMPONENT/SITE/LANG/de-DE.com_component.ini
&lt;== J_ROOT/LANGUAGE/de-DE/de-DE.com_component.ini

PRJ-ROOT/COM_COMPONENT/ADMIN &lt;== J_ROOT/ADMINISTRATOR/COMPONENTS/COM_COMPONET
PRJ-ROOT/COM_COMPONENT/ADMIN/LANG/en-GB.com_component.ini
&lt;== J_ROOT/ADMINISTRATOR/LANGUAGE/en-GB/en-GB.com_component.ini
PRJ-ROOT/COM_COMPONENT/ADMIN/LANG/de-DE.com_component.ini
&lt;== J_ROOT/ADMINISTRATOR/LANGUAGE/de-DE/de-DE.com_component.ini

PRJ-ROOT/MOD_MODULE &lt;== J_ROOT/MODULES/MOD_MODULE
PRJ-ROOT/MOD_MODULE/LANG/en-GB.mod_module.ini
&lt;== J_ROOT/LANGUAGE/en-GB/en-GB.mod_module.ini
PRJ-ROOT/MOD_MODULE/LANG/de-DE.mod_module.ini
&lt;== J_ROOT/LANGUAGE/de-DE/de-DE.mod_module.ini

PRJ-ROOT/PLG_PLUGIN/plugin.php &lt;== J_ROOT/PLUGINS/GROUP/plugin.php
PRJ-ROOT/PLG_PLUGIN/LANG/en-GB.plg_group_plugin.ini
&lt;== J_ROOT/ADMINISTRATOR/LANGUAGE/en-GB/en-GB.plg_group_plugin.ini
PRJ-ROOT/PLG_PLUGIN/LANG/de-DE.plg_group_plugin.ini
&lt;== J_ROOT/ADMINISTRATOR/LANGUAGE/de-DE/de-DE.plg_group_plugin.ini
</pre>
<p>As you see languages files of plug-ins installed to administration part of Joomla!. Why so, ask Joomla! developers.</p>
<h2>2. internationalization (i18n)</h2>
<p>Most of extensions require internationalization. This mechanism is simple to use in Joomla!, but it has some ambiguous decisions.</p>
<p>To use internationalization support of text messages in the code of extensions instead of output of simple strings we should use next construction:  JText::_(&#8216;text message&#8217;); This call check current locale and using appropriate localization file returns required string.</p>
<p>For instance if current locale is &#8216;en-GB&#8217; then it seek for appropriate file:<br />
for “site part” of Joomla!:  joomla-root/language/en-GB/en-GB.com_component.ini<br />
and in that file I look for sting with id &#8216;TEXT MESSAGE&#8217;</p>
<p>If it can&#8217;t find appropriate file then it returns passed string.</p>
<p><strong>Structure of localization file:</strong><br />
identifier=value</p>
<p>identifier – is a string, it should be written in UPPER CASE.<br />
Value – is a localized value.</p>
<p><strong>Example:</strong><br />
We need to output 2 internationalized strings<br />
echo JText::_(&#8216;This is test message.&#8217;);<br />
echo JText::_(&#8216;Hello world.&#8217;);</p>
<p>Then we create localization file for appropriate locale en-EN.com_component.ini:<br />
THIS IS TEST MESSAGE=This is test message.<br />
HELLO WORLD.=Hello all.</p>
<p>de-DE.com_component.ini:<br />
THIS IS TEST MESSAGE=Das ist testen Meldung.<br />
HELLO WORLD.=Halo eine Welt.</p>
<p>I want to note that in order to use that mechanism for plug-ins you should invoke method  loadLanguage of class Jplugin:</p>
<p>loadLanguage(<br />
[name of localization file],<br />
[path to root directory of site part of admin part of Joomla!]</p>
<p>name of localization file, by default plg_group_plugin.ini path to root directory, can be: “j_root/administrator” or  “j_root” (by default)</p>
<h2>3. layouts</h2>
<p>Layouts is a handy mechanism which let us to avoid using of  “if construction”  in “view” of the MVC model [<a href="http://en.wikipedia.org/wiki/Model-view-controller">http://en.wikipedia.org/wiki/Model-view-controller</a>] which Joomla! 1.5 began to use actively for extensions development.</p>
<p>By default structure of extensions presentation in Joomla (for modules, and components) has next structure:</p>
<pre>EXTENSION-ROOT
	VIEWS
	   VIEW
               TMPL
		 default.php
	     view.html.php
</pre>
<p>Here “view.html.php” file is a  common part of presentation which can commonly contains invocations of “model” (MVC) or in other words where we extract data that necessary for data output, and some simple logic.<br />
There is a rule to place mature logic to model or controller(MVC). In the “TMPL” directory we keep different presentations. They contain markup or in other words exact presentation of data. An file “default.php “ is a default layout, so it will be used if we wasn&#8217;t selected another one. You can easily create additional layouts adding them to &#8216;TMPL&#8217; directory files with name “layoutname.php”. In order to select specific layout you should in the controller(MVC) before invocation of display() function<br />
select its name with command: JRequest::setVar(&#8216;layout&#8217;, &#8216;layoutname&#8217;);</p>
<h2>4. using of AJAX</h2>
<p>It is hardy to imagine an application that can be developed nowadays without AJAX. [<a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29">http://en.wikipedia.org/wiki/Ajax_%28programming%29</a>]</p>
<p>It is much easier to use some javascript library like jquery, mootols, dojo, etc.. to invoke Ajax-based methods. I like jquery [http://jquery.com]. However Joomla! Developers have selected another Javascript library – mootols [http://mootools.net] and so I earnestly recommend to you to use for ajax methods invocations Mootools library. If you anyway want to use your favorite JavaScript library you must switch your library to the compatibility mode.</p>
<p>For instance for Jquery it can be do it with:<br />
var jq = jQuery.noConflict();<br />
then instead of &#8216;$&#8217; you should use  &#8216;jq&#8217; but anyway keep in mind that most of extensions for JavaScript libraries don&#8217;t use that mode and so you will have Javascript error because of name collisions.</p>
<p>Example of MVC flow using Ajax invocation:<br />
- Create task in the controller, ex.: getAjaxData</p>
<pre>	“controller.php”:
	function getAjaxData() {
		JRequest::setVar('view', 'viewname');
		JRequest::setVar('layout', 'ajaxlayout');

		parent::display();
	}
</pre>
<p>- Create layout, ex: ajaxlayout</p>
<pre>	“viewname/tmpl/ajaxlayout.php”:
	&lt;?php defined('_JEXEC') or die('Restricted access');

	global $mainframe;
	echo &lt;ajax data&gt;;

	$mainframe-&gt;close();
	?&gt;
</pre>
<p><strong>Important note:</strong><br />
You should add invocation: $mainframe-&gt;close();<br />
in order to create output flow or it will add Joomla! standard page after result of you Ajax method. Thus creating concrete layout you can pass any data, don&#8217;t forget to setup appropriate header. For XML [<a href="http://en.wikipedia.org/wiki/Xml">http://en.wikipedia.org/wiki/Xml</a>] it can be: header(&#8220;Content-type: text/xml;charset=utf-8&#8243;);</p>
<p>On client-side yous should make invoke defined method using Ajax call, using URL like:<br />
JURI::root().&#8217;index.php?option=com_component&amp;task=getajaxdata&#8217;;</p>
<h2>5. mapping of tables to the Database</h2>
<p>Joomla! using simple ORM system [<a href="http://en.wikipedia.org/wiki/Object-relational_mapping">http://en.wikipedia.org/wiki/Object-relational_mapping</a>].<br />
In order to use this mechanism you should describe your DB structure with sets of objects that inherit JTable.</p>
<p>For example:<br />
foo.php:</p>
<pre>&lt;?php
defined('_JEXEC') or die('Restricted access');

class TableFoo extends JTable {
	var $id = null;
	var $bar = null;

	function TableFoo(&amp; $db) {
		parent::__construct('#__foo', 'id', $db);
	}

	function bind( $from, $ignore=array() ) {
		$from['bar'] = strtoupper($from['bar']);
		return parent::bind($from, $ignore);
	}

	function check() {
		if (empty($this-&gt;bar)) {
			$this-&gt;setError( 'Error message');
			return false;
        		}
		return true;
	}

	function delete( $oid=null ) {
		$res = parent::delete($oid);

		// here if you need you can define mechanism
		// to delete linked tables
		return $res;
    	}
}
?&gt;
</pre>
<p>First of all it is necessary to define public variables that corresponding to fields names of table. Then you should pass name of the table and name of primary key to the constructor.</p>
<p><strong>key methods:</strong></p>
<p>Bind() method using in order to transfer data from external sources (ex.: requst) into object. Overriding that method you can execute specific data transformations of data before adding to the fields of the object.<br />
Check() method make checking of data in the fields, for example it can check that fields not empty or filled with required range of values, etc.<br />
Delete() method  can add specific behavior during deletion of  records. For example deleting of linked records.</p>
<p>Also JTable class contains set of other handy methods  overriding which you can add appropriate specific behavior.<br />
<em> See Joomla! documentation for details.</em></p>
<p><strong>possible use:</strong></p>
<p>You can get object in the model (MVC) with following: $row =&amp; $this-&gt;getTable(&#8216;foo&#8217;);</p>
<p>to delete record you invoke: $row-&gt;delete($id)</p>
<p>to store record to db:<br />
$row-&gt;bind($data);<br />
$row-&gt;check();<br />
$row-&gt;store();</p>
<p>If then you need  get value of primary key you can simply take the value from the object: $row-&gt;id;</p>
<p>Surely it is better to add to described calls check of result of methods executions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blogs.helion-prime.com/2008/05/12/joomla-15-extensions-development-hints.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
