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

    I did a news page. There you can enter the month, a text, a picture and a link.

            <main id="up-to-date" role="main">
                <div class="container">
                    <div class="news-content"> 
                        <h3>[[*news-month]]</h3>                                    
                        <div class="col-12">
                            <div class="row">                            
                                <div class="col-md-9">            
                                    [[*news-content]]
                                    [[$news-link]]                                
                                </div>                            
                                <div class="col-md-3">
                                    [[$news-picture]]
                                </div> 
                            </div><!-- row -->
                        </div><!-- col-12 -->
                        <hr><!-- divider -->
                    </div><!-- news-Content -->                
                </div><!-- container -->
            </main><!-- main →
    


    The picture and the link are not necessary. So that they do not show up if nothing is entered, I have created the following chunks:

    [[*news-link:notempty=`[[$newslink]]`]]
    
    [[*news-picture:notempty=`[[$newspicture]]`]]
    


    Now I've created a tpl that should map all the content to the parent page. But I do not know how to do that with the chunk.

                     <div class="news-content"> 
                        <h3>[[+tv.news-month]]</h3>                                    
                        <div class="col-12">
                            <div class="row">                            
                                <div class="col-md-9">            
                                    [[+tv.news-content]]
                                    [[$news-link]]                                
                                </div>                            
                                <div class="col-md-3">
                                    [[$news-picture]]
                                </div> 
                            </div><!-- row -->
                        </div><!-- col-12 -->
                        <hr><!-- divider -->
                    </div><!-- news-content -->
    
    


    Can somebody help me? I'm a beginner with modx.

    Best regards,
    Michael

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

      • 3749
      • 24,544 Posts
      I'm not completely clear on what you're trying to do.

      I'm assuming that the pages are created by editing resources in the Manager and putting the values in Template Variables.

      If you just want to display that final chunk with the values filled in for the current page, you'd want to replace + with * in those tags (making sure the value in the tags is the actual name of the tv with no prefix). You'd place a tag for the chunk where you want the output to appear.

      If, instead, you're aggregating multiple pages and showing multiple versions of that chunk one after the other, you'd want to leave it as is and use getResources or pdoResources to show the results -- specifying that chunk in the &tpl property of the snippet tag.

        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • discuss.answer
        • 44200
        • 33 Posts
        Quote from: BobRay at Jan 31, 2019, 09:17 PM
        I'm not completely clear on what you're trying to do.

        Thanks for your help!!

        Solved it!!

        Best regards,
        Michael [ed. note: mibolu last edited this post 5 years, 3 months ago.]