Adding a selectable background to a Yootheme template

Applies to:
  • Joomla 2.5.8
  • Yootheme Template 2012

What?
For any web-developer who can program in PHP/HTML, this would be easy to hard-code and override. However, the article below demonstrates how to make this an option that your client can switch off/on using the Joomla Admin Panel.

How?
For demo purposes, I'm going to add the background "Ambient Turquoise". Yootheme uses CSS files to do this so we'll need to modify the XML file and add some files that this will select.
  1. Modify \templates\<yootheme_template>\config.xml add the select option "Ambient Turquoise" to the end of the list:
    copyraw
    <fields name="Profiles">
    		<field name="Style" type="separator" />
    		<field name="style" type="styles" default="" label="Style" description="Select the style variation." />
    		<field name="background" type="list" default="grey" label="Background" description="Select the background.">
    			<option value="grey">Grey</option>
    			<option value="dots">Dots</option>
    			<option value="tartan">Tartan</option>
    			<option value="lines">Lines</option>
    			<option value="dark_squares">Dark Squares</option>
    			<option value="light_squares">Light Squares</option>
    			<option value="mosaic">Mosaic</option>
    			<option value="turquoise">Turquoise Color</option>
    			<option value="ambientturquoise">Ambient Turquoise</option>
    1.  <fields name="Profiles"> 
    2.          <field name="Style" type="separator" /> 
    3.          <field name="style" type="styles" default="" label="Style" description="Select the style variation." /> 
    4.          <field name="background" type="list" default="grey" label="Background" description="Select the background."> 
    5.              <option value="grey">Grey</option> 
    6.              <option value="dots">Dots</option> 
    7.              <option value="tartan">Tartan</option> 
    8.              <option value="lines">Lines</option> 
    9.              <option value="dark_squares">Dark Squares</option> 
    10.              <option value="light_squares">Light Squares</option> 
    11.              <option value="mosaic">Mosaic</option> 
    12.              <option value="turquoise">Turquoise Color</option> 
    13.              <option value="ambientturquoise">Ambient Turquoise</option> 
  2. Add a \templates\<yootheme_template>\css\background\ambientturquoise.css file. Note the same filename as in the option value of the previous step.
    copyraw
    body#page { 
    	background: #f4f5f5 url(../../images/background/ambientturquoise/ambientturquoise.jpg) 0 0 no-repeat; 
    }
    1.  body#page { 
    2.      background: #f4f5f5 url(../../images/background/ambientturquoise/ambientturquoise.jpg) 0 0 no-repeat; 
    3.  } 
  3. If using an image, create a folder and add the image matching the path in the previous step: \templates\<yootheme_template>\images\background\ambientturquoise\ambientturquoise.jpg
  4. Test by logging into the Joomla Admin Panel > Extensions > Template Manager > Styles > "Select the Background" > Save/Apply
  5. Done!

Additional Note
  • I do not work for Yootheme.
  • I did not post this to Yootheme forums because you have to be a paying member to access these and I tend to piggyback on my client's subscriptions.
  • This information does not come from Yootheme forums.
  • I am too lazy to answer/update my solutions in 3rd-party forums.
Category: Joomla :: Article: 447

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: The information on this website is provided without warranty and any content is merely the opinion of the author. Please try to test in development environments prior to adapting them to your production environments. The articles are written in good faith and, at the time of print, are working examples used in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com

Related Articles

Joes Revolver Map

Accreditation

Badge - Certified Zoho Creator Associate
Badge - Certified Zoho Creator Associate

Donate & Support

If you like my content, and would like to support this sharing site, feel free to donate using a method below:

Paypal:
Donate to Joel Lipman via PayPal

Bitcoin:
Donate to Joel Lipman with Bitcoin - Valid till 8 May 2022 3QnhmaBX7LQSRsC9hh6Je9rGQKEGNQNfPb
© 2021 Joel Lipman .com. All Rights Reserved.