We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 40728
    • 29 Posts
    Is there an article or tutorial on using custom (list) templates and images in blogposts?

    It's actually surprising to find so little articles on this subject in the Googles and this subforum.

    Here's my issue:

    I'm building a blog and want to have images in the posts (one or more). I'm getting good results in creating my own templates and the getResources function. So that's awesome. But:

    * On the homepage I'm displaying the latest article. Above it I want to display the article's main (featured) image. (Same goes for the article page.)

    * Then, on the homepage, a list of recent articles follows, in which I also want to display a thumbnail version of the article's main image.

    So far, I can't really find a straightforward way of adding images to blogposts (to be retreived in the getResources call) without adding them through the RTE.

    Can anyone point me in the right direction? Thanks!
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      If the images are TVs, then getResources can retrieve the image TV you want.
        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
        • 40728
        • 29 Posts
        I don't see how this answers my questions. Sorry.

        As it is now, using the RTE, when I add an image into the blogpost, I have to upload it using the RTE's interface and then I get an <img> tag in the content which simply points to a file on the filesystem.

        I'm looking for ways to attach one or more images to a blogpost, possibly marking one as the "featured" image of the blog post, and retrieve those in various ways.

        Is this at all possible, and if so, can you point me to any source describing the desired solution or ways to accomplish this?
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Make them image-type TVs. You can use a snippet such as phpthumbof when displaying the output of the TV.
            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
            • 40728
            • 29 Posts
            Can someone get splittingred in here to do some support? The Articles and Gallery documentations fail horribly in providing good beginner answers. These short answers aren't getting me anywhere either.

            My questions are simple and clear:

            Can I add images to a blogpost other than by inserting them into the content, and if so, how do I do this, or where do I find out how to do this. If it is not possible, please don't hesitate to say so.

            Like the user in this thread (18 months old), I have yet to find a straightforward solution using articles and gallery: https://forums.modx.com/thread/?thread=50635&page=2


              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Yes. Create image TVs and assign them to the articles template. Go to the main Articles configuration page, and adjust the settings in the Advanced Settings fields for handling TVs.
                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
                • 40728
                • 29 Posts
                Hi,

                what do you suggest is the best way to set up this TV?

                I've had it set to input: URL, output:string, which worked fine for testing purposes (getting the hang of it) except now I have to sup[ply a URL to an image on the web. Ultimately I want the blogger to be able to pick and upload an image right there.

                So, I had it set to input: image, and all kinds of weird stuff happens, most notably my CPU (sometimes both) goes up to 100% for a while and memory usage goes up as well.
                in the browser, I'll see the "Maximum execution time exceeded" php error.

                My co-worker expected some sort of recursion going on, but we can't find out why this is giving errors.

                On top of that, when I add the TV to the blog article template, some path it echoed into my manager interface above the blogpost editor (see attachment). What is causing this?

                Any suggestions?

                Thanks!
                  • 40728
                  • 29 Posts
                  I just confirmed this behavior is happening, so far, only when I set input type to "image".
                    • 28000 ☆ A M B ☆
                    • 397 Posts
                    I am using Revo 2.2.5 and Articles 1.6.3, followed all of Susan's steps as well as double checked with the documentation and am having the problem that Articles does not process or recognize any template variables in the listing chunk. I tried image TVs and a text TV....
                      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Did you check the settings in the Articles configuration?
                        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