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

    How can I add an article image to the ArticleRowTpl so an image from the article shows up with the article in archive or article listings?

    This question has been answered by Tyreal2012. See the first response.

    • discuss.answer
      • 30912
      • 463 Posts
      Simple, in your settings set includeTV's to Yes and process TV's to Yes then add:

      <img src="[[+tv.YourTvName]]"/>


      Into your code in the ArticleRowTpl and all should work fine.

      Make sure that your Article Page has the correct TV assigned to it.
        • 42141
        • 73 Posts
        I solved it a bit differently (ensuring in the article that the image is before all the text, so it gets included in the summary), but this is definitely more elegant! Thank you!
          • 30912
          • 463 Posts
          Glad i could help,

          you could add a conditional on the tv as well using If to make it optional smiley
            • 18809
            • 109 Posts
            Hello,
            I need something like this. I want post thumbnail image to load automatically from my article. Just like featured image of Wordpress, to fetch first(or any) image from the post. So I don;t have to add thumbnails for each post. And its best when I import articles from Wordpress blog xml and then I don;t have to add post thumb to my hundreds of imported articles.
            Hope you understand what I want to write.
            Sorry for bad English.
              My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
              • 42141
              • 73 Posts
              Coming back to my original question smiley:

              Ideally, I want to create something like this list of articles with a thumbnail: http://royalcentral.co.uk/category/royalhistory

              and on the frontpage I would like create blocks like this: http://royalcentral.co.uk/ A picture linking to an in depth article. Over the picture the title of the article is displayed.

              Is this possible to achieve with MODx? I know it super easy with Wordpress...
                • 30912
                • 463 Posts
                Its easy to do, just wrap the tags around the image tv.

                <a href="[[~[[+id]]]]" title="[[+pagetitle]]"><img src="[[+tv.YourTvName]]"/></a> 


                I dont have access to a full chunk anymore (as i dont work for the web dev agency anymore) so this what im about to post isnt tested but you will get the idea. try this for your blogArticle chunk.

                
                <div class="blogContainer">
                	<h1><a href="[[~[[+id]]]]">[[+pagetitle]]</a></h1>
                	<p class="blogContIntro">
                		[[+publishedon:strtotime:date=`%a %b %e, %Y`]]
                	</p>
                	<div class="clear">
                	</div>
                	<div class="blogImage">
                		<a href="[[~[[+id]]]]" title="[[+pagetitle]]"><img src="[[+tv.YourTvName]]"/></a>
                	</div>
                	<div class="blogIntro" id="blog">
                		<p>
                			[[+introtext]]
                		</p>
                		<p>
                			<a href="[[~[[+id]]">Read more ></a>
                		</p>
                	</div>
                </div>