We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    This is driving me nuts!

    I created a folder structure for my template css and images. I went to Files>assets and created two new directories templates>css and templates/images. I then added my css file and my images to the relevant folders.

    The template is connecting with the css file just fine. But the background images within my css do not show? I am testing this site locally.

    This is the css I am puzzled over:
    #banner{
      width:990px;
      height:270px;
      background: url(/assets/templates/nutricompounds/images/banner.jpg) no-repeat red;}


    The height, width and red color of the box show fine, but the image does not?

    I have tried changing the first part to
    url(../assets/
    url(assets/
    url(templates/
    url(../templates/
    url(/templates/

    What the heck am I missing here? Why won’t this image show???

    Thanks!
      • 3749
      • 24,544 Posts
      Try changing the path to one relative to the CSS file location.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 23299
        • 1,161 Posts
        Quote from: BobRay at Feb 24, 2011, 09:28 PM

        Try changing the path to one relative to the CSS file location.

        Care to shine a little more light on that please?
          • 3749
          • 24,544 Posts
          Quote from: Photowebmax at Feb 24, 2011, 09:40 PM

          Quote from: BobRay at Feb 24, 2011, 09:28 PM

          Try changing the path to one relative to the CSS file location.

          Care to shine a little more light on that please?

          What’s the path to the CSS file?

          If it’s assets/css/file.css, then this should work (though you say you’ve tried it):

          ../templates/etc.


          Another thing to try is

          [[++assets_url]]templates/etc.

            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
            • 23299
            • 1,161 Posts
            Just to check this I created a new directory in Files>assets called "images"

            I then adjusted my css like so:
            #banner{
              width:990px;
              height:270px;
              background:url(../images/banner.jpg) no-repeat top red;}


            That shows the image!

            Obviously the system is expecting to find images in the assets/images folder? But I had to create this images folder first! I have no idea why the system will not match the path declared in my css when it matches the folder system I created in the Files pane as described in my first post?

            One of the things I find really annoying with Revo is deciding where stuff goes? I went to System Settings > File Settings but I don’t see anything that indicates the path to css images or how to adjust the path if I so desire? I prefer the Evo system for this kind of thing. I would like to create a folder for my template files. All my css and background css images need to go in this folder. The images I upload to content document/pages I would prefer to go elsewhere, like the assets>images folder. This is what I am used to doing in Evo. Its nice to keep these two types of images (one for template presentation and one for document content) separate from each other.


              • 3749
              • 24,544 Posts
              I’m 99% sure that Revo doesn’t care where the image file is. I’m willing to bet that there was something wrong with your path. There’s usually something wrong with mine. tongue

              Sometimes the cache is an issue, too. It isn’t cleared when you edit the CSS file.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 23299
                • 1,161 Posts
                I tried this:
                #banner{
                  width:990px;
                  height:270px;
                background:url(../templates/nutricompounds/images/banner.jpg) no-repeat top red;}


                I then cleared the cache and refreshed the front end page: no image...

                I have no idea.
                ...reaching for that extra glass of wine...
                  • 3749
                  • 24,544 Posts
                  What happens when you put this in the browser address line?

                  http://yoursite.com/assets/templates/nutricompounds/images/banner.jpg


                  (assuming that /templates is directly below /assets)
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 23299
                    • 1,161 Posts
                    Good detective work there Bob!

                    I entered this:
                    http://localhost:8888/nutricompounds/assets/templates/nutricompounds/images/banner.jpg


                    And the image shows just fine by itself...

                    I am really hoping this is not something stupid I have done? The reason I mention this with full disclosure is that I have made this kind of boob before...
                      • 33337
                      • 3,975 Posts
                      According to this, [tt]http: //localhost:8888/nutricompounds/assets/templates/nutricompounds/images/banner.jpg[/tt] where is the css file? eg.

                      [tt]http: //localhost:8888/nutricompounds/assets/templates/ [HERE] /nutricompounds/images/banner.jpg?[/tt]
                        Zaigham R - MODX Professional | Skype | Email | Twitter

                        Digging the interwebs for #MODX gems and bringing it to you. modx.link