Αναπροσδιορισμός του output του πηγαίου κώδικα του Joomla!
From Joomla! Documentation
This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
This page has been archived. This page contains information for an unsupported Joomla! version or is no longer relevant. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Υπάρχουν περιπτώσεις όπου χρειάζεται να αλλάξετε τον τρόπο που μια Επέκταση του Joomla! (όπως μια Εφαρμογή ή ένα Ένθεμα, είτε ενσωματωμένο στο Joomla!, είτε από τρίτο κατασκευαστή) εμφανίζεται στην ιστοσελίδα σας.Φυσικά, μπορείτε να ξαναγράψετε από την αρχή τον κώδικα της Επέκτασης, αλλά μάλλον αυτό θα ήταν κάπως φιλόδοξο! Ευτυχώς, υπάρχει και άλλος τρόπος.
Ο προκαθορισμένος τρόπος εμφάνισης για κάθε Ένθεμα ή Εφαρμογή που έχει ενσωματωθεί στο Joomla! μπορεί να παρακαμφθεί με την προσθήκη κώδικα στο φάκελο html
του template που χρησιμοποιείτε. Είναι επίσης δυνατόν να παρακάμψετε δυο βασικές πτυχές της λειτουργικότητας του Joomla!: Module chrome και σελιδοποίηση.
Από την οι αναπροσδιορισμοί μπορούν να δημιουργηθούν χρησιμοποιώντας την επιλογή Διαχείριση Προτύπων - Template manager Creating 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
to
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
to
TEMPLATE_NAME/html/mod_login/default.php
Joomla! comes pre-packaged with a frontend template called Protostar. Protostar 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 Protostar template. Inside the Protostar template directory, you'll find a directory named html
.
The entire directory structure is as follows:
/your_joomla/templates/Protostar/html/
If you want to try modifying the overrides used in Protostar, you could simply copy and paste the Protostar 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):
<folder>html</folder>
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
You can override Joomla's core images that are stored in the /media/ folder. Put an alternative image with the same name in your template folder. For example, the Breadcrumbs Module uses an orange arrow that is retrieved from /media/system/images/arrow.png. Joomla will use your override version if you put it at /templates/your_template_name/images/system/arrow.png.
Template overrides are almost limitless. They allow you to add, edit, and remove the components of the Joomla! core output. The Template Manager can be used to create override files ready for editing.
Note: All modern browsers ship with high quality debugging tools which are 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:
- The article Understanding Output Overrides explains the theory behind template overrides.
- The preferred way of changing text output is by using translations in your template.
- j-over.de has a huge collection of overrides to use for your own templates (note site is only in German).