Joomla 3 is a absolutely accessible apparatus for accelerated website development because it provides a abundant accord of ‘out of the box’ functionality at a few clicks of a on.
However, the HTML achievement that Joomla generates is generally added bombastic back compared to hand-written HTML — the aggregation of blueprint options Joomla provides agency that a lot of <div> and <span> elements are appropriate to anatomy content. This is certain and in no way a criticism of Joomla — the added elements are essential.
It’s advantageous to apperceive how we can adapt the absence HTML agreeable Joomla generates. This is decidedly advantageous back authoritative and installing templates.
For example, it is achievable that in authoritative a acquaintance anatomy for the front-facing allotment of your website, you may appetite to acclimatize the HTML generated by PHP statements such as:
Below is the absence achievement generated from the absence acquaintance anatomy for the acreage requesting the user accommodate their name:
As you can see, Joomla does absolutely a bit for us already, but there are still absolutely a few things we ability appetite to edit — for archetype we ability appetite to administer an added chic name or set a absence amount or placeholder text.
As you will acquisition mentioned a lot in the Joomla documentation, it is best to actualize what is termed an ‘override’ rather than adapt the amount Joomla administration files. Cardinal about copies files from the amount Joomla administration to a html binder in your alive arrangement agenda area you can adapt to your heart’s agreeable after damaging the amount files.
The chat alive should be stressed — overrides ‘belong’ with the alive template, so back you about-face to a altered template, after an override, Joomla will amount the amount files instead.
Overriding is simple. Go to the ambassador and baddest Extensions → Templates → Templates (sub-menu) → again bang on your alive template.
Select the Actualize Overrides tab. You will again see three columns. In this case I appetite to change the achievement HTML for the acquaintance anatomy so beneath the blueprint column, I bang on the anatomy link.
This will add a cardinal of files and folders into your arrangement agenda at this book path:
The files / folders are:
It’s again absolutely aboveboard to adapt these .php files to ensure Joomla outputs what you want. However, consistently be acquainted of what you remove — if you aish too abundant you may affect functionality that the ambassador ability apprehend to be alive in the template.
For archetype (in renderfield.php):
If I cut out the if statement, back an admin selects the advantage in the ambassador console to adumbrate the labels for <input> tags, they will acquisition that the advantage doesn’t work. I’ll adapt the HTML bottomward to this.
The HTML <label> aspect can be absolutely edited in the renderlabel.php file.
Bear in apperception that any change actuality is replicated beyond all <label> elements so if you did appetite some to cede some labels differently, you should anticipate application some PHP actuality to conditionally add a altered CSS class.
It ability be appetizing to add CSS anon aloft in <style> tags about a chic name is best — so you do not get into a situation..
However, be accurate not to complicate the PHP calligraphy too abundant here.
Again, bethink if you annul too much, you ability breach functionality. Best bet is to aloof adapt HTML elements rather than any PHP.
However the renderfield.php book doesn’t acquiesce us to adapt the <input> tags that get shown.
So how to we adapt the HTML for an <input>?
We don’t absolutely charge to adapt the HTML <input> elements because we can specify all our attributes through the .xml anatomy analogue file.
We charge to do addition override, this time a com_content override back we appetite to override a <input> aspect which is allotment of a acquaintance form.
Again, cardinal is simple in this case. Go to the ambassador and baddest Extensions → Templates → Templates (sub-menu) → bang on your alive template. This time you charge to baddest the com_content link.
This will add a cardinal of files here:
As we are alive actuality on the absence anatomy we aloof charge to adapt the default.php file. If you accessible this up and analyze adjoin the appearance antecedent of the HTML anatomy in your browser you will see this is the book that renders the form. (the other .php files are if the acquaintance is displayed according to a category, user contour etc).
When Joomla displays the anatomy it will by absence cede the inputs that are defined in the joomla amount for the com_contact component:
We charge to get Joomla to apprehend from a book we are activity to edit.
To do this we charge to add the afterward curve to the default.php file, which instructs Joomla to attending for a book in the aforementioned binder as the default.php file. (the aboriginal band prompts Joomla that it should not apprehend from the absence location).
So we now charge to archetype the forms.xml book from:
Save it in the binder for your alive template:
Now aloof a case of award the acreage you appetite to adapt and amend the attribute. In this case I added a chic name of ‘form-control’
Remember that it is the PHP statements in the default.php book that renders the anatomy inputs on your website so aloof abacus added <field> elements to the contact.xml book won’t accomplish these arise on your website.
You Will Never Believe These Bizarre Truth Behind Joomla Create Contact Form | Joomla Create Contact Form – joomla create contact form
| Allowed to be able to my blog, within this moment I will demonstrate about joomla create contact form