We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18397
    • 3,250 Posts
    @fizzy: You need to use ` for parameters instead of ’. Then all should work.

    @neon_eddy: There are sample pages in the demo site content. More documentation is coming soon!
      • 9763
      • 16 Posts
      Quote from: Mark at Mar 06, 2006, 05:43 PM

      @fizzy: You need to use ` for parameters instead of ’. Then all should work.

      @Mark: thank you *so* much! I feel *very* silly now embarrassed - I never realised they were funny backquote characters - I’ve just never used them in coding before... once again i’m reminded to copy and paste wherever possible!
        • 6841
        • 61 Posts
        Couple of questions from a MODx newbie...

        First, it seems to be standard practice around here to lump all discussion about a snippet into a single thread (at least in the case of the NewsListing snippet). In all other forums I’ve participated in, that called thread hijacking and is very uncool, so I just want to verify whether or not I should be posting here of starting a separate thread if my question is about the NewsListing snippet.

        Now for my real problem... I am trying to use the NewsListing snippet, and I’m getting the following message on my page:

        Your NewsListing template is missing placeholders, please check your template below:

        This message is then followed by a single hyperlink which shows the longtitle of the containing page (not any of the pages in the folder pointed to by the snippet parameters).

        What does this mean? I have installed the latest version of the snippet per the instructions in the ZIP file. I have created a page and put in the following to call the snippet:

        [[NewsListing? &tpl=`NewsListingTemplate` &startID=`11` &summarize=`2`]]


        I’ve also created a NewsListingTemplate chunk that contains the following (which I got from http://modxcms.com/NewsListing.html):

        <div class="nl_summaryPost">
        <h3><a href="[~~]">[*longtitle*]</a></h3>
        <div></div>
        <p></p>
        <div style="text-align:right;">by <strong></strong> on </div>
        </div>


        So, does anyone have any pointers to get me going in the right direction? I’d really appreciate it. I’ve been searching through these forums off and on for a day or two, and I haven’t yet found anything that seems to help.

        Thanks.
          Dave
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: ddecjc at Mar 10, 2006, 01:23 PM

          I’ve also created a NewsListingTemplate chunk that contains the following (which I got from http://modxcms.com/NewsListing.html):

          <div class="nl_summaryPost">
          <h3><a href="[~~]">[*longtitle*]</a></h3>
          <div></div>
          <p></p>
          <div style="text-align:right;">by <strong></strong> on </div>
          </div>


          Ah, that would be an issue with the documentation -- refresh the page at http://modxcms.com/NewsListing.html and check out the NewsListing template now. Those missing pieces were the placeholders you are wondering about, and we’re being removed by the MODx parser when presented for output as a code example.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            We’re reasonably laid back here about posting, although it would be better to open a new thread with a clear subject line.

            Anyway, your template needs placeholders to indicate where the various parts generated by the snippet should go. For example, the default template looks like this:

             <div class="nl_summaryPost">
                    <h3><a href="[~[+id+]~]">[+title+]</a></h3>
                    <div>[+summary+]</div>
                    <p>[+link+]</p>
                    <div style="text-align:right;">by <strong>[+author+]</strong> on [+date+]</div>
                </div>
            


            Notice the [+...+] tags.

            You can also use TVs as placeholders. See the comments in the beginning of the snippet code for more information on that.
              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
              • 6841
              • 61 Posts
              Thanks Jason and Susan. This is making much more sense now.

              BTW, is there one place I can go to learn about all the various tag styles (e.g. [[]], [!!], {++}, [~~], etc.) or do I just have to browse through all the documentation and pick that up as I go? I’ve seen a few explanations already, but, until I get used to all this stuff, I can see myself needing to be continually reminded.

              Thanks for the quick help...
                Dave
                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: ddecjc at Mar 10, 2006, 02:01 PM

                BTW, is there one place I can go to learn about all the various tag styles (e.g. [[]], [!!], {++}, [~~], etc.) or do I just have to browse through all the documentation and pick that up as I go? I’ve seen a few explanations already, but, until I get used to all this stuff, I can see myself needing to be continually reminded.

                http://modxcms.com/modx-tags.html is a good place for reference and links to more information on the tags.
                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Heh, I just added a few bits to it in response to your comments.
                    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
                    • 17665
                    • 54 Posts
                    Man this forum post is getting huge... would it be possible to delete some of the older postings about older versions that are no longer relevent?

                    Any way, here’s my question:

                    We’re using NewsListing to create a "Recently Added" section to the front of our website. I thought everything was working great (sorting by pub_date) until I noticed that in cases where the pub_date was not set, it was reverting back to the createdon date. Found the code where this happens in line 167 of functions.php:

                    $query= "SELECT id , type , contentType , pagetitle , longtitle , description , alias , published , IF(pub_date > 0, pub_date, createdon) as pub_date, IF(unpub_date > 0, unpub_date, createdon) as unpub_date , parent , isfolder , introtext , content , richtext , template , menuindex , searchable , cacheable , createdby , createdon, editedby , IF(editedon > 0, editedon, createdon) as editedon, deleted , IF(deletedon > 0, deletedon, createdon) as deletedon, deletedby , menutitle , donthit , haskeywords , hasmetatags , privateweb , privatemgr , content_dispo , hidemenu  FROM $tblContent WHERE parent IN ($validParents) $activeClause $folderClause ORDER BY $sortby $sortdir";
                    


                    Is it really necessary to have these IF statements? I was really confused because I expected it to sort by pub_date (knowing the value would be 0 if unset) only to find that it was putting in the createdon date. Has anyone else been confused by this? I’d like to avoid modifying the code to suit my needs, but I also would like it to work as expected. Any suggestions?

                    This snippet is awesome by the way. We even used it to do a photo gallery: http://www.everynation.org/en/navigation-menu-top/photo-gallery/the-year-in-pictures.html

                    Thanks!
                      • 18397
                      • 3,250 Posts
                      Regarding the pub_date issue, It is intentionally coded that way as very few people know about the bug that pub_date, when unset, is 0 (which will be fixed in an upcoming release).

                      Thanks for the compliment! Really appreciate the feedback!