<?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>Libre d'esprit &#187; ajax</title> <atom:link href="http://libre-d-esprit.thinking-days.net/tag/ajax/feed/" rel="self" type="application/rss+xml" /><link>http://libre-d-esprit.thinking-days.net</link> <description>Logiciels libres, joomla, talend, php, virtuemart, templates Joomla</description> <lastBuildDate>Thu, 28 Oct 2010 11:04:51 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.0.4</generator> <item><title>Joomla et AJAX : créer une page minimaliste</title><link>http://libre-d-esprit.thinking-days.net/2009/04/joomla-et-ajax-creer-une-page-minimaliste/</link> <comments>http://libre-d-esprit.thinking-days.net/2009/04/joomla-et-ajax-creer-une-page-minimaliste/#comments</comments> <pubDate>Thu, 09 Apr 2009 21:06:31 +0000</pubDate> <dc:creator>Antoine</dc:creator> <category><![CDATA[Joomla]]></category> <category><![CDATA[ajah]]></category> <category><![CDATA[ajaj]]></category> <category><![CDATA[ajax]]></category> <category><![CDATA[index2]]></category> <category><![CDATA[no_html]]></category> <category><![CDATA[template]]></category> <guid
isPermaLink="false">http://libre-d-esprit.thinking-days.net/?p=160</guid> <description><![CDATA[Dans le cadre de développement AJAX, (voire AJAJ, ou AJAH puisque dans la pratique, je pense que le HTML et le JSON sont plus utilisés que le XML), il est nécessaire de pouvoir afficher une page Joomla minimaliste, c&#8217;est à dire une page Joomla qui ne contiendra exclusivement le texte écrit par le composant. En [...]]]></description> <content:encoded><![CDATA[<p>Dans le cadre de développement AJAX, (voire AJAJ, ou AJAH puisque dans la pratique,  je pense que le HTML et le JSON sont plus utilisés que le XML), il est nécessaire de pouvoir afficher une page Joomla minimaliste, c&#8217;est à dire une page Joomla qui ne contiendra exclusivement le texte écrit par le composant. En outre, le template du site ne devra pas être affiché.</p><p>Pour cela, il existe trois techniques principales :</p><h3>Template vide</h3><p>On crée un gabarit qui ne contient rien d&#8217;autre que les données affichées par le composant Joomla.</p><h4> Version Joomla 1.0</h4><div
class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span> <br
/> <a
href="http://www.php.net/defined"><span
style="color: #990000;">defined</span></a><span
style="color: #009900;">&#40;</span> <span
style="color: #0000ff;">'_VALID_MOS'</span> <span
style="color: #009900;">&#41;</span> <br
/> or <a
href="http://www.php.net/die"><span
style="color: #990000;">die</span></a><span
style="color: #009900;">&#40;</span> <span
style="color: #0000ff;">'Direct Access to this location is not allowed.'</span> <span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> <br
/> mosMainBody<span
style="color: #009900;">&#40;</span><span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span> <br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><h4>Version Joomla 1.5</h4><div
class="codecolorer-container php dawn" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div
class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000000; font-weight: bold;">&lt;?php</span><br
/> <a
href="http://www.php.net/defined"><span
style="color: #990000;">defined</span></a><span
style="color: #009900;">&#40;</span> <span
style="color: #0000ff;">'_JEXEC'</span> <span
style="color: #009900;">&#41;</span> <br
/> or <a
href="http://www.php.net/die"><span
style="color: #990000;">die</span></a><span
style="color: #009900;">&#40;</span> <span
style="color: #0000ff;">'Restricted access'</span> <span
style="color: #009900;">&#41;</span><span
style="color: #339933;">;</span><br
/> <span
style="color: #339933;">&lt;</span>jdoc<span
style="color: #339933;">:</span><span
style="color: #b1b100;">include</span> type<span
style="color: #339933;">=</span><span
style="color: #0000ff;">&quot;component&quot;</span> <span
style="color: #339933;">/&gt;</span><br
/> <span
style="color: #000000; font-weight: bold;">?&gt;</span></div></div><p>On crée ensuite une entrée de menu dans un menu qui n&#8217;est pas affiché. On récupère l&#8217;identifiant numérique de cette entrée de menu (Itemid). On suppose que l&#8217;Itemid vaut 32.</p><p>A cette entrée de menu, on affecte le template vite récemment crée.</p><p>Maintenant, pour avoir un affichage minimal, il suffit de spécifier l&#8217;Itemid nouvellement créé dans la querystring (la querystring sera donc semblable à : index.php?option=com_virtuemart&#038;page=shop.XXXXX&#038;Itemid=32).</p><h3>Index2 avec no_html</h3><p>Sur le front-office, il suffit d&#8217;appeler index2.php à la place d&#8217;index.php et de rajouter no_html=1 dans la querystring (exemple : index2.php?option=com_virtuemart&#038;page=shop.XXXXX&#038;no_html=1).</p><p>Sur le back-office, c&#8217;est la page index3.php qui doit être appelée à la place de la page index2.php.</p><h3>Page de chargement de joomla minimaliste</h3><p>Cette méthode consiste à recréer un fichier PHP, qui ne soit pas chargé par Joomla, afin de gagner en performance. Pour cela, il faut faire de l&#8217;ingénieurie inverse, et s&#8217;y prendre en plusieurs fois pour déterminer quels sont les fichiers à inclure et  dans quel ordre, quel groupe de mambots/plugins doit être chargé, quelles sont les variables globales qui doivent être déclarées et comment.. En bref, cela devient à mes yeux vite chronophage, et n&#8217;est pas toujours justifié. Je ne vais donc pas détailler davantage cette technique dans ce billet.</p> ]]></content:encoded> <wfw:commentRss>http://libre-d-esprit.thinking-days.net/2009/04/joomla-et-ajax-creer-une-page-minimaliste/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
