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

    I am building my own template for a website, current located at my localhost.

    In this site I would like to be able to change the picture in my right column somehow.

    My initial idea is to use Template Variables, but I do not have a clue how this could be arranged, so I would like to know if anyone can help me?

    Please see the enclosed picture to get an idea of what I am talking about.

    Could anyone help me?

    //Carsten - modx newbie
      You don
      • 15152
      • 360 Posts
      Is this a background image or just an image placed within a div. If it’s an image within a div it is real simple. Something like this:

      <div id="rightColumn">
      <img src="[+your template variable+]" alt="[+Your TV Title+]" />
      </div>

      In the description for the TV you should define the sizing the image has to be.
        There are no boring projects. Only boring executions. ~ Etzkorn
        www.impress-design.com
        • 25899
        • 46 Posts
        Quote from: JWMSales at Apr 12, 2010, 02:40 PM

        Is this a background image or just an image placed within a div. If it’s an image within a div it is real simple. Something like this:

        <div id="rightColumn">
        <img src="[+your template variable+]" alt="[+Your TV Title+]" />
        </div>

        In the description for the TV you should define the sizing the image has to be.

        Hi JWM

        Thanks for a swift reply.
        However, as I mentioned I am a complete newbie and I really do not know how to compile this template variable and TV title.

        However it would be nice to know this.

        Could you explain it to me, and yes it is meant to be a picture.
        //Carsten
          You don
          • 25899
          • 46 Posts
          Quote from: JWMSales at Apr 12, 2010, 02:40 PM

          Is this a background image or just an image placed within a div. If it’s an image within a div it is real simple. Something like this:

          <div id="rightColumn">
          <img src="[+your template variable+]" alt="[+Your TV Title+]" />
          </div>

          In the description for the TV you should define the sizing the image has to be.

          Hi again

          I have now tried the following, but with no success.
          I added this to my template in the source code: <img src="[+imageShow+]" alt="[+test+]" />

          Then I made this action in my TV editor, see the attached picture.

          Still nothing comes out, even though I have chosen different pictures when editing my pages.

          Could someone spot the error?

          //Carsten
            You don
            • 4310
            • 2,310 Posts
            The way you have set up the TV means just having [*imageShow*] in your template should work without any <img> tags
              • 25899
              • 46 Posts
              Quote from: bunk58 at Apr 12, 2010, 03:38 PM

              The way you have set up the TV means just having [*imageShow*] in your template should work without any <img> tags
              Hi Bunk58

              I have now changed my TV code in my template to be as follows: <img src="[+imageShow+]" />

              But still in my frontend, the html still renders <img src="">
              Meaning absolutely nothing in any way?

              //Carsten
                You don
                • 4310
                • 2,310 Posts
                No <img> tags needed.
                Just have [*imageShow*] in the template where you want the image to show.
                N.B. asterix, not plus signs.
                  • 25899
                  • 46 Posts
                  Quote from: bunk58 at Apr 12, 2010, 03:52 PM

                  No <img> tags needed.
                  Just have [*imageShow*] in the template where you want the image to show.
                  N.B. asterix, not plus signs.

                  Hi again bunk58

                  Now it works super!!

                  I have another easy question if you have the time.

                  Earlier JWMsales mentioned that I could make an alt tag by doing something like this (read the first post)
                  [+Your TV Title+]

                  How would I get this working?
                  Like so?: [*title*] or what?

                  //Carsten
                    You don
                    • 17720
                    • 21 Posts
                    Hello. I thought I’d include a few template tutorial links since I am struggling through learning them myself.

                    http://wiki.modxcms.com/index.php/Template_Variable

                    http://net.tutsplus.com/tutorials/other/working-with-a-content-management-framework-modx/
                    (the middle section gets into template variables)

                    http://codingpad.maryspad.com/2009/04/20/building-a-website-with-modx-for-newbie-part-6-introducing-template-variables/
                    (best tutorial for getting started in Modx, IMHO)

                    good luck