We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6595
    • 20 Posts
    I want to display 3 different news stories but only want to display a summary of the text with a link saying (read more) thattl take u to the whole story. I managed to get this alrite but now in my blog template I have three different stories but teh links are all going to the same place. Its the same when I try to insert an image, it just appears three times. Heres the code I have.


    </br><h4><strong>
    [+title+]
    </h4></strong>

    <p>
    [+introtext+]

    (<a href="[~55~]">..read more</a>)

    </p>

    The ’55’ reference is the link to one of the news stories. Does any1 know how to alter this so I can use three different links?

    Thanks
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      <br></br><h4><strong>
      [+title+]
      </h4></strong>
      
      <p>
      [+introtext+]
      
      (<a href="[~[+id+]~]">..read more</a>)
      
      </p>
      
        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
        • 6595
        • 20 Posts
        Yeah thanks that solves the problem with the links but now how can I display three different images for each story.Its just going to be a small thumbnail to accompany the text. Heres the bit of code with the image code palced in as well.


        </br><h4><strong>
        [+title+]
        </h4></strong>

        <p>
        [+introtext+]

        <img align="left" alt="Image1" height="184" src="assets/images/42-15868234b.jpg" width="152" />

        (<a href="[~[+id+]~]">..read more</a>)

        </p>

        Any ideas??
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Use a TV in each individual news item page, with image input type and an image output widget, and call the TV in your template chunk [+tvname+]
            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
            • 6595
            • 20 Posts
            Sorry im not quite sure what you mean.Could you break it down a bit or post up some example code i could use?

            Thanks
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Make a TV with its input type "Image" and an output widget Image. Name it whatever you want, newsItemImage for example. Assign it to the template your individual news pages use.

              When you create/edit a news page, just use that TV to select the image for that page (the image input widget will even allow you to upload the image if it’s not already on the site).

              Now, in your Ditto chunk template have
              <br></br><h4><strong>
              [+title+]
              </h4></strong>
              
              <p>
              [+introtext+]
              
              [+newsItemImage+]
              
              (<a href="[~[+id+]~]">..read more</a>)
              
              </p>

              Why do you have <h4><strong>...</h4></strong>? That should be nested like <h4><strong>...</strong></h4> . And anyway, isn’t h4 strong by default? If not you could style it with font-weight: bold in your CSS file.
                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
                • 5091
                • 332 Posts
                Quote from: Darragh23 at Jan 22, 2008, 10:25 AM

                Yeah thanks that solves the problem with the links but now how can I display three different images for each story.Its just going to be a small thumbnail to accompany the text. Heres the bit of code with the image code palced in as well.


                </br><h4><strong>
                [+title+]
                </h4></strong>

                <p>
                [+introtext+]

                <img align="left" alt="Image1" height="184" src="assets/images/42-15868234b.jpg" width="152" />

                (<a href="[~[+id+]~]">..read more</a>)

                </p>

                Any ideas??

                I believe you should put your above code as chunk, then in the Document page (where you want to show this three news listing), add a Ditto calls and use that chunk for tpl.

                By the way, you should wrap the <h4><strong>[+title+]</strong></h4>, and there is no
                </br>, it should be self closing like so
                .

                For best practise, it’s better not to use break to gain vertical spacing. Use padding(s) (top or bottom) instead, and declare it in your CSS. You can also declare ’font-weight:bold’ for h4 in your CSS, this way you don’t need to use <strong>. All headings by default are bolded, so unless you declare ’font-weight: normal’ somewhere for your h1 - h6 headings, you don’t need to add ’strong’.

                  • 7231
                  • 4,205 Posts
                  Here is some documentation on Template Variables:
                  http://modxcms.com/creating-a-template-variable.html
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don&#39;t know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 6595
                    • 20 Posts
                    think ive got it sorted now.although how do i wrap the text around the image . Im workin from a live site so il post up the link here.

                    http://www.customerminds.com/Site3/news.html
                      • 36592
                      • 970 Posts
                      You can set any class/id/style in the image widget propaty setting to the <img> tag..