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

    I’m slowly but surely working my way through my first ever MODx site, pretty much starting from the top-down.

    Firstly, I’m attempting to create a header and I’ve already got Wayfinder (which is a wonderful piece of kit) creating a menu. Currently, I have a logo for the site (not yet implemented) that I’d like to add to every page (obviously), but the client expressed an interest in being able to change it at will.

    Assuming that my client isn’t all that copmuter-savvy, could anybody recommend a method that would make this possible? I must admit, I hardly know any php, but Im willing to have a bit of a poke around to get things done.

    Thanks in advance,
    Chris

    Edit: I’m using Revolution 2.0.7 should it make any difference.
      • 19369
      • 1,098 Posts
      You could create an img Template Variable and assign it to the homepage template, and then use a snippet like GetField to use the variable in all pages.

      GetField for Revo: http://modxcms.com/forums/index.php?topic=48794.0
        • 5143
        • 116 Posts
        That looks very promising - I’ll give it a go.

        Thanks!
          • 23571
          • 223 Posts
          I do this quite a bit and have found that this works very well: http://www.gregorysmart.com/2010/01/08/create-a-user-config-page-in-modx/
            • 5143
            • 116 Posts
            Thanks pleth.

            That may be a little over-kill in this instance, but I’ll certainly bookmark it for future reference.
              • 5143
              • 116 Posts
              I’ve acquired and installed the GetResourceField add-on, but am having a little trouble making it access the TV I’ve created.

              One a page called "home" I’ve added a TV called "logo" which simply outputs an image file.
              Then, in the "header" chunk that will be included on every page I have added the following:

              [tt][[getResourceField? &id=`home` &field=`logo` &processTV=`1` &default=`Logo`]][/tt]

              But nothing seems to output at all, which is leaving me puzzled...

              Any suggestions?

              Edit: I’ve changed the [tt]&id=`home`[/tt] to [tt]&id=`1`[/tt] and it seems to partially work, in that it outputs the filepath, but not the file itself.
              Wrapping this output in the following did the trick:

              [tt]<img src=" ... " />[/tt]

              Answered my own question, but may as well leave it here in case anyone else has similar trouble.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Snippets almost always use the resource ID; the pagetitle usually considered the "name" of a resource can change, but the resource ID is always the same.
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 33337
                  • 3,975 Posts
                  Quote from: chr.s at Feb 11, 2011, 12:50 PM

                  ...

                  [tt][[getResourceField? &id=`home` &field=`logo` &processTV=`1` &default=`Logo`]][/tt]

                  ...

                  [tt][[getResourceField? &id=`123` &field=`logo` &isTV=`1` &default=`Logo`]][/tt]

                  id = numeric id of the page.
                  isTV = if you want to fetch the TV
                    Zaigham R - MODX Professional | Skype | Email | Twitter

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