Using com config for frontend template style editing
From Joomla! Documentation
Revision as of 04:21, 15 October 2013 by Buddhima
In early versions, it was a bit difficult thing for users to figure out how to change basic settings after installing Joomla! for the first time. To reduce that difficulty front-end component com_config make it possible to do some of those settings through front-end. Through this template view of com_config, super users can easily change current template style parameters and view the changes soon after clicking Save!
Access to Templates View
For beginners, we encourage you to install Joomla! With sample data Blog English (GB) Sample Data or Brochure English (GB) Sample Data. If you installed with one of two data sets, you can access it by clicking “Template Settings” on Main Menu (login as super-user will be required).
In other cases you can simply add it to the any menu. Following steps are for adding it to Main menu (super-user privileges are required).
1. Login to back-end (administrator view)
2. Go to 'Menus → Main Menu → Add New Item'
3. Set “Menu Item Type” to 'ConfigurationManager → Display Template Options'
4. Set “Menu Title” to “Template Settings”
5. Finally click “Save & Close”
6. Now login front front-end as the super-user
7. Click on menu item “Template Settings” on Main Menu
8. You will get Template Settings which is allowed by the current front-end template
You can do settings and view those changes very quickly. Hope you feel that this is pretty much easier than changing template settings from administrator view.
For Template Developers
This has the flexibility for template developers to specify the parameters which to be shown on the front-end. It is just to adding com_config.xml file with relevant fields to the template folder as shown below.
Note: If no such file included in template folder, this component will take all the config fields mentioned in the templateDetails.xml
For this case, Protostar template is used (which is the default template after Joomla! 3.0).
1. Open the folder 'PATH_TO_JOOMLA_DIR → templates → protostar'
2. Create a file named com_config.xml
3. Add the following code
<?xml version="1.0" encoding="utf-8"?> <config> <fields name="params"> <fieldset name="basics"> <field name="templateColor" class="" type="color" default="#08C" label="TPL_PROTOSTAR_COLOR_LABEL" description="TPL_PROTOSTAR_COLOR_DESC" /> <field name="templateBackgroundColor" class="" type="color" default="#F4F6F7" label="TPL_PROTOSTAR_BACKGROUND_COLOR_LABEL" description="TPL_PROTOSTAR_BACKGROUND_COLOR_DESC" /> <field name="logoFile" class="" type="media" default="" label="TPL_PROTOSTAR_LOGO_LABEL" description="TPL_PROTOSTAR_LOGO_DESC" /> </fieldset> </fields> </config>
4. Above code segment says only to show Template Colour, Background Colour and Logo fields only for the front-end.
5. Thereafter you clicking Template Settings you will only see the previously mentioned fields are there.
Similarly for any template this can be used, but special inspection of the template designer may be required.
From this feature, it is believed that Joomla! super-users will get more efficient way of customizing their web sites and also template developers will use this for their beneficial to serve the clients.
Important: Some templates will not directly support this by adding a com_config.xml. Templates also should support viewing fields added to com_config.xml. Therefore it is highly recommended to consult the template developer for concerns arising when enabling this feature for a particular template.