We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53161
    • 130 Posts
    Hello,

    I am looking for a way the user to upload an logo and the logo to appear in all resources. I tried many different things, with @INCLUDE, galleryitem, etc, but I just can't think of a way the image to appear in all pages. Please help.

    This question has been answered by BobRay. See the first response.

      • 3749
      • 24,544 Posts
      If I'm understanding you, putting the img tag for the logo image in all your Templates should do it. The Template is where you put anything you want to see on multiple pages.
        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
        • 53161
        • 130 Posts
        Yes, I did that, but I want the admin to be able to upload a custom logo and for it to appear in all pages. I tried this:

        <a href="/" id="logo">
                            [[*Logo]]
                        </a>
        


        But this compels the admin to upload the logo in every single resource, which is horrible.
        • discuss.answer
          • 3749
          • 24,544 Posts
          Maybe I'm still not following you, but you can put a tag like this in the Template where you want the image to appear:

          <img src="yoursite.com/images/logo.png" />

          Then just have the admin upload and overwrite that file to create a new logo image -- or upload a logo image with a new name and edit that single line in your Template.

          Another method would be to have an image Template Variable (TV) called Logo with the path to the image as its default value, and this in your template where you want the image:

          [[*Logo]]


          Then, all you have to do to use a new logo is to upload it and change the image file name in the TV. This will be significantly slower than the first method.

          ***************

          It just occurred to me that you might made the rookie mistake of having a different Template for each page. That would explain your trouble. wink

          Many sites have only one or two templates. I think Bob's Guides has two (a second one for the Blog).

            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
            • 17301
            • 932 Posts
            I haven't used it myself but a good alternative might be this freebie extra from modmore

            https://www.modmore.com/extras/clientconfig/screenshots/

            It looks like they have provisions for the client to upload a 'logo' into one centralised place there - along with a bunch of other convinent fields to make global configs simple for the client.
              ■ email: [email protected] | ■ website: https://alienbuild.uk

              The greatest compliment you can give back to us, is to spend a few seconds leaving a rating at our trustpilot: https://uk.trustpilot.com/review/alienbuild.uk about the service we provided. We always drop mention of services offered by businesses we've worked with in the past to those of interest.
              • 53161
              • 130 Posts
              Quote from: BobRay at Apr 05, 2017, 05:01 PM
              Maybe I'm still not following you, but you can put a tag like this in the Template where you want the image to appear:

              <img src="yoursite.com/images/logo.png">

              Then just have the admin upload and overwrite that file to create a new logo image -- or upload a logo image with a new name and edit that single line in your Template.

              Another method would be to have an image Template Variable (TV) called Logo with the path to the image as its default value, and this in your template where you want the image:

              [[*Logo]]


              Then, all you have to do to use a new logo is to upload it and change the image file name in the TV. This will be significantly slower than the first method.

              ***************

              It just occurred to me that you might made the rookie mistake of having a different Template for each page. That would explain your trouble. wink

              Many sites have only one or two templates. I think Bob's Guides has two (a second one for the Blog).


              Thank you Bob, I ended up doing what you suggested. Just have to make sure I explain the admin where to upload the logo.

              I use different templates for different functionality, but it is the same header + footer, + chunks for html stuff that I use for more than one page. Is this still a rookie mistake?
                • 53161
                • 130 Posts
                Quote from: lkfranklin at Apr 06, 2017, 12:49 AM
                I haven't used it myself but a good alternative might be this freebie extra from modmore

                https://www.modmore.com/extras/clientconfig/screenshots/

                It looks like they have provisions for the client to upload a 'logo' into one centralised place there - along with a bunch of other convinent fields to make global configs simple for the client.

                OMG. Do you have any idea for how long was I looking for such a plugin? I needed a plugin to input global variables in cause otherwise I'd have to the $scriptProperties which is not very user friendly. Thank you so much!
                  • 3749
                  • 24,544 Posts

                  I use different templates for different functionality, but it is the same header + footer, + chunks for html stuff that I use for more than one page. Is this still a rookie mistake?

                  It's difficult to say without knowing more about the "functionality," but you can often introduce different functionality in other ways. For example, you can have a snippet that only executes on pages with a particular parent. Another example would be a Template Variable that contains the name of a chunk to insert into the page.

                  There's nothing technically wrong with having a lot of templates, but it can make maintaining the site more tedious.
                    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
                    • 36551
                    • 416 Posts
                    Another option that may work for you. Put the template variable on your home page. Then use getResourceField extra, in all your templates, to pull the contents of the logo field from the home page. I've used this approach for footer content as well.
                      • 53161
                      • 130 Posts
                      Quote from: BobRay at Apr 06, 2017, 04:35 PM

                      Another example would be a Template Variable that contains the name of a chunk to insert into the page.





                      TVs can inject chunks??