0
Welcome Guest! Login
0 items Join Now

Background Chooser not choosing background

    • practice's Avatar
    • practice
    • Jr. Rocketeer
    • Posts: 30
    • Thanks: 0

    Background Chooser not choosing background

    Posted 12 years 3 months ago
    • Here's my problem, I started with the latest Gantry bundle (4.1.4) with the hopes of developing a simple template. I need the ability to chose the background image in the back end template editor (the same way most RT themes function) so I can easily set up alternate background for other pages using an alternate style.

      I dove in to the code and seem to have hit a wall. I got a drop down menu for the background image chooser to appear in the template's back-end, and it saves the settings fine, but the background is not displaying.

      Here is a link to the site: webstage.dentalmarketer.com/shanahan

      Here's what I've done so far:
      1- Edited the file "template-options.xml" to include
      <field name="background" type="selectbox" default="none" label="BG_IMAGE" isbodyclass="true" setinsession="true" setbysession="true" setincookie="true" setbycookie="true">
              <option value="none">None</option>
              <option value="main-bg">Main Background</option>
              <option value="secondary-bg">Secondary Background</option>
              <option value="third-bg">Third Background</option>
       </field>

      2- Edited the file "index.php" (accessed from the back-end via 'Edit main page template") to include:
       <body <?php echo $gantry->displayBodyTag(array('bodyLevel')); ?>>
          <div id="rt-page-background" <?php echo $gantry->displayClassesByTag('rt-page-background'); ?>>

      3- Edited the file "styledeclarations.php" to include:
      // Background
          $css = 'body {background:'.$gantry->get('rt-page-background').';}'."\n";

      4- Added a custom css file "gantry-custom.css" then included:
      /* Background Images */
      .main-bg div#rt-page-background {background: url(../images/backgrounds/pm-bg_01.jpg) 50% 0 no-repeat;}
      .secondary-bg div#rt-page-background {background: url(../images/backgrounds/pm-bg_02.jpg) 50% 0 no-repeat;}
      .third-bg div#rt-page-background {background: url(../images/backgrounds/pm-bg_03.jpg) 50% 0 no-repeat;}

      I've cleared my caches and checked the file paths, but I still get no background image. I just know I'm missing something that should be obvious, but after days of searching the forums I am at a loss.

      Please oh please you amazing RT devs, help me get this working.
    • David Goode's Avatar
    • David Goode
    • Preeminent Rocketeer
    • Posts: 17058
    • Thanks: 890
    • Web Designer and Host

    Re: Background Chooser not choosing background

    Posted 12 years 3 months ago
    • Hi there,

      Have you confirmed the images have been uploaded correctly? The only one I can find by direct url is pm-bg_01.jpg while the others give a 404 error.

      Hope this helps 8)

    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information
    • practice's Avatar
    • practice
    • Jr. Rocketeer
    • Posts: 30
    • Thanks: 0

    Re: Background Chooser not choosing background

    Posted 12 years 3 months ago
    • I only have the one image placed at the moment as I have yet to set up an alternate style with which to place the alternate BGs. So yes, trying to go directly to those files will give you a 404 because those files are not yet in use and have therefore not been uploaded.

      The main BG image is only visible now because I cheated in order to keep working on the site. I simply added the following line to my custom css file:

      #rt-page-background {background: url(../images/backgrounds/pm-bg_01.jpg) 50% 0 no-repeat;}

      But I still have the original problem I posted: the background image chooser I have set up in the back-end is visible, but it's settings are not applying to the site.

      Any ideas?
    • David Goode's Avatar
    • David Goode
    • Preeminent Rocketeer
    • Posts: 17058
    • Thanks: 890
    • Web Designer and Host

    Re: Background Chooser not choosing background

    Posted 12 years 3 months ago
    • Hi there,

      I can see an error in template-options.xml - It begins field name... but this is a multiple so it should be fields name...

      Hope this helps 8)

      Thanks for your patience.

    • Please search forums before posting. Please make sure your post includes the version of the CMS you are using and a link to the problem. Annotations on screenshots can also be helpful to explain problems/goals. Please use the "secure" tab for confidential information

Time to create page: 0.066 seconds