We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33657
    • 128 Posts
    So I got a TV to work in the ArticleRowTpl by including TV's and processing TV's in the options of Articles, but when I create a sidebar list of the latest articles, I want a little thumbnail in there. no matter what I do, it will not show. (get a broken link).

    I tried the same code as my main list but it fails.


    <img src="[[+tv.mainImage:default=`images/news-blank.gif`:phpthumbof=`w=32&h=32&zc=1`]]" alt="[[+pagetitle]]" class="entry-image">


    is it possible to use TV's on the latest post listing? or am i limited to just TV's on just the main page? it really doesnt make sense that the TV can't pass.. it has to be something wrong on my part.

    any help or suggestions?

    thanks!
    • I have the same issue, have you found a solution to this?
        • 47885
        • 6 Posts
        I'm having the same problem and I quite don't understand why it isn't working.

        <ArticleRowTpl> working:
        [[+tv.articlePreview:notempty=`<img src="[[+tv.articlePreview]]" class="img-right" alt="[[+pagetitle]]" />`]]


        <ArticlesLatestPostTpl> not working:
        [[+tv.articlePreview:notempty=`<img src="[[+tv.articlePreview]]" class="img-responsive" alt="[[+pagetitle]]" />`]]


        No magic, quite plain, no difference, just another CSS class. It took time to get first working also, I don't know what made the difference in the end, but as quoted it is working.

        TV config in Articles page are both set to Yes with an empty list, TV is available on all templates (also problem occurs on the same page, Articles list has the Latest sidebar as well).

        Thanx
          • 4172
          • 5,888 Posts
          this is the function, which gets the latest posts.
          There aren't properties like &includeTVs and &processTVs in that call.

              /**
               * Get the call for the latest posts
               *
               * @param string $placeholderPrefix
               * @return string
               */
              public function getLatestPostsCall($placeholderPrefix = '') {
                  $settings = $this->getContainerSettings();
                  $output = '[[getResources?
                      &parents=`'.$this->get('id').'`
                      &hideContainers=`1`
                      &showHidden=`1`
                      &tpl=`'.$this->xpdo->getOption('latestPostsTpl',$settings,'sample.ArticlesLatestPostTpl').'`
                      &limit=`'.$this->xpdo->getOption('latestPostsLimit',$settings,5).'`
                      &offset=`'.$this->xpdo->getOption('latestPostsOffset',$settings,0).'`
                      &sortby=`publishedon`
                      &where=`{"class_key":"Article"}`
                  ]]';
                  $this->xpdo->setPlaceholder($placeholderPrefix.'latest_posts',$output);
                  return $output;
              }
          


          So, if you need TVs in that output, you will need to replace the placeholder with your own getResources-call or put getField - snippet-calls or FastField - tags into the tpl.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 47885
            • 6 Posts
            Thank you very much, problems source found, question left: Bug or feature?
            I would think of bug, I cannot guess why TVs should not be available here.

            Unfortunally I'm quite novice to MODX, so I don't really know the proper way to solve this. Patching Articles code (articlescontainer.class.php) solves it, but that is ugly (and will get lost on next update). Replacing the placeholder sounds like the proper clean way. But where can I do such? Writing some kind of snippet? Any doc or example for further help?
              • 4172
              • 5,888 Posts
              I would say neither Bug nor Feature.

              Maybe missing Feature is the correct term.
              You can do a feature-request at github.

              Replace the placeholder
              [[+{prefix}latest_posts]]
              in your articles-container-template with

              [[getResources?
                      &parents=`[[*id]]`
                      &hideContainers=`1`
                      &showHidden=`1`
                      &tpl=`sample.ArticlesLatestPostTpl`
                      &limit=`5`
                      &offset=`0`
                      &sortby=`publishedon`
                      &where=`{"class_key":"Article"}`
                      &includeTVs=`1`
                      &processTVs=`1`
                  ]]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 47885
                • 6 Posts
                Seems to be fixed in 1.7.10