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

    I installed HitsPage and now trying to get the title of 3 most viewed documents to show on my main template. I read the documents but i did not understand how to implement it. I am not a good coder. I created a new TV called HitsPage and put the input type as Number. And then I put [[!HitsPage? &saveTv=`true`]] on my template for individual news document. Then I put the other code on my main pages template:
    [[!getResources?
    &parents=[[1]]
    &limit=`3`
    &sortbyTV=`HitsPage`
    &sortbyTVType=`integer`
    ]]

    And I refreshed my home page with the main template. I saw only one news title was listed instead of 3.

    Actually, I don't know if i implemented the HitsPage snippet at all. The documentation is not nicely detailed as in Mary's tutorial in codingpad.maryspad.com. So, newbies like me get confused where to put the coding pieces, what to create where. Please direct me to the right direction. Thank you.

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

    [ed. note: oinomt last edited this post 13 years, 3 months ago.]
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      In the first place, is that &parents=[[1]] really in your getResources snippet call? That should be &parents=`1`

        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
        • 43939
        • 19 Posts
        Thank you. I fixed that. Still I get nothing. I may have put these calls in a wrong place or I may have not created what was necessary. I just have no idea. Please help. Thank you.
        • discuss.answer
          • 3749
          • 24,544 Posts
          In the getResources tag, you need:

          &includeTVs=`1`


          As an option to speed things up, you can add this (but get it working without it first):

          &includeTVList=`12` (change 12 to the ID of the HitsPage TV)

          To implement the HitsPage snippet, just download and install it in Package Manager.
          Check on the Elements tab to make sure there is a HitsPage snippet.
            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
            • 43939
            • 19 Posts
            BobRay,

            You're so great! Thank you very very much! Now I can see the most popular ones smiley Hooray.
              • 3749
              • 24,544 Posts
              I'm glad it worked for you. smiley
                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