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

    Probably this was asked before but I could not find anything on it

    In the front page I would like to display a list of articles but not only the title(linked to the content) and intro text but also a small image

    what I have done so far is use ditto on a container

    template for ditto
    <div class="newsItem">
    HERE SHOULD BE THE IMAGE
    <a href="[~[+id+]~]">[+#title+]</a>
    <p>[+#introtext+]</p>
    </div>

    and [!Ditto? &depth=`1` &parents=`12` &tpl=`NR`!] in template

    How can I make the template get an image and in the same time let the user update the image.

    Thank you

      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use a TV for the image. Ditto will set a placeholder for the TV value, and you can use it in your template chunk.
        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
        • 5340
        • 1,624 Posts
        hmm I tried that
        used [*name*] but did not work

        I will try again
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          try [+name+], since you’re using a placeholder that Ditto automatically creates for every TV for the documents. You should probably make it more specific, like "ni_image_name" or something, so you won’t risk collisions with any values already set.
            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
            • 5340
            • 1,624 Posts
            Thx, it worked.
              • 5340
              • 1,624 Posts
              It worked but the results look messy because of quickedit.
              So I tried using the html tags for quick edit but it does not work

              <div class="newsItem">
              <quickedit:img_news/>
              <quickedit:title/>
              <quickedit:introtext/>

              [+img_news+]
              <a href="[~[+id+]~]">[+title+]</a>
              <p>[+introtext+]</p>
              </div>

              It seems that quickedit in html mode does not know from were to take img_news, etc

              Now I am trying to use the Quick Edit Custom Links but there is something wrong.
              http://www.modxcms.com/quickedit.html#how-links (the example needs an a <a href not < href)

              <div class="newsItem">
              <a href="index.php?a=112&id=4&doc=[+id+]&var=img_news" target="_blank">Edit</a>
              <a href="index.php?a=112&id=4&doc=[+id+]&var=title" target="_blank">Edit</a>
              <a href="index.php?a=112&id=4&doc=[+id+]&var=introtext" target="_blank">Edit</a>
              [+img_news+]
              <a href="[~[+id+]~]">[+title+]</a>
              <p>[+introtext+]</p>
              </div>

              I think there is something wrong with the ID and A parameters.
              I got the id from ManageResources/Plugins rolled over QuickEdit and saw id=4 and a=102
              When I click on edit I go to index.php?a=102&id=4&doc=15&var=img_news which is correct but I get the HOME page.

              I think I do not have the right ID and A variables.
              Can someone explain how to get them and what A represents?

              THx


                • 33337
                • 3,975 Posts
                Its a "[QuickEdit module id]" .. not plugin ID.
                  Zaigham R - MODX Professional | Skype | Email | Twitter

                  Digging the interwebs for #MODX gems and bringing it to you. modx.link
                  • 5340
                  • 1,624 Posts
                  Thx zi

                  It seems that the id is 2(taken from MySite/Modules or from one of the quickedit popups)

                  But every time I try to click on the links I get sent to the error page.

                  <div class="newsItem">
                  <a href="index.php?a=112&id=2&doc=[+id+]&var=img_news" target="_blank">Edit</a>
                  <a href="index.php?a=112&id=2&doc=[+id+]&var=title" target="_blank">Edit</a>
                  <a href="index.php?a=112&id=2&doc=[+id+]&var=introtext" target="_blank">Edit</a>
                  [+img_news+]
                  <a href="[~[+id+]~]">[+title+]</a>
                  <p>[+introtext+]</p>
                  </div>

                  Am I missing something?
                    • 5340
                    • 1,624 Posts
                    SOLVED

                    <div class="newsItem">
                    <a href="manager/index.php?a=112&id=2&doc=[+id+]&var=img_news" target="_blank">Edit</a>
                    <a href="manager/index.php?a=112&id=2&doc=[+id+]&var=title" target="_blank">Edit</a>
                    <a href="manager/index.php?a=112&id=2&doc=[+id+]&var=introtext" target="_blank">Edit</a>
                    [+img_news+]
                    <a href="[~[+id+]~]">[+title+]</a>
                    <p>[+introtext+]</p>
                    </div>

                    I had to put manager/ in front of the link. Maybe someone can correct on the http://modxcms.com/quickedit.html
                      • 33337
                      • 3,975 Posts
                      Thanks for the correction xpix. I updated the page.

                      regards.
                        Zaigham R - MODX Professional | Skype | Email | Twitter

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