HowTo: Sobrescribir la salida del core de Joomla!

febrero 4, 2009
1 Star2 Stars3 Stars4 Stars5 Stars (Sin votos)
Cargando…

Puede que haya ocasiones en las que te gustaría cambiar la forma en que una extensión de Joomla (como un Componente, Módulo ya sea del propio core de Joomla! o de terceras partes) se muestra en tu sitio web. Por supuesto, podrías recodificar la extensión de cero, pero eso sería muy ambicioso por tu parte! Afortunadamente, hay otra solución.

La salida HTML estándar de cualquier Módulo o Componente Joomla! puede ser sobrescrito añadiendo código al directorio html de tu plantilla. También es posible sobrescribir dos aspectos de la funcinalidad del core: Module chrome, y paginación.

Getting a head-start with overrides

If you are new to Joomla! development, then it is probably easiest to start with an existing view, and try modifying it to get what you want. To do this, you should make a copy of the existing view in the html directory of your template, and then modify the copy.

The directory structure you need is:

TEMPLATE_NAME/html/EXTENSION_NAME/VIEW_NAME/FILE_NAME.php

For example, if you want to change the way that the ‘Article’ view displays a com_content article, then you should copy the file at

PATH_TO_JOOMLA/components/com_content/views/article/tmpl/default.php<br />to<br />TEMPLATE_NAME/html/com_content/article/default.php

(note the slight difference in directory structure)

Similarly, if you want to change how the mod_login Module is displayed, then you should copy

PATH_TO_JOOMLA/modules/mod_login/tmpl/default.php<br />to<br />TEMPLATE_NAME/html/mod_login/default.php

Joomla! comes pre-packaged with a frontend template called Beez. Beez utilizes template overrides to produce a table-less layout for faster, smoother, and semantically correct markup. To see how it’s done, locate your Joomla! installation’s template directory, and you’ll notice the Beez template. Inside the Beez template directory, you’ll find a directory named html

the entire directory structure is as follows:

/your_joomla/templates/Beez/html/

If you want to try modifying the overrides used in Beez, you could simply copy and paste the Beez html directory into your own template’s main directory. However you choose to make your override files, you will need to ensure that they are correctly installed with your template. To do this, you should add the following code to your template’s templateDetails.xml file (in between the <files> and </files> tags):

<span class="sc3"><span class="re1"><folder<span class="re2">></span></span></span>html<span class="sc3"><span class="re1"></folder<span class="re2">></span></span></span>

The above code in essence lets the Joomla! package installer know that there are files to extract, and that they are part of the template as a whole.

Further tips

Template overrides are almost limitless. They allow you to add, edit, and remove the components of the Joomla! core output. Note: For the FireFox web browser, an extension is available called Firebug, which is useful for browsing a page’s HTML source and matching it up with the PHP code used in template overrides.

More information is available from the following resources:

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *