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: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience 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 bc1qf6elrdxc968h0k673l2djc9wrpazhqtxw8qqp4

Ethereum:
Donate to Joel Lipman with Ethereum 0xb038962F3809b425D661EF5D22294Cf45E02FebF
© 2024 Joel Lipman .com. All Rights Reserved.