We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 121
    • 36 Posts
    Hi, I wonder if you can help..

    I am trying to set up a property site for my father in law and so far all is going smooth. But I seem to have an issue with using ListIndexer.

    Each property has it’s own page, and Properties for Sale is the parent (as I cannot seem to set up folders being a complete noob with modxcms).



    On my generated page I have an Address, Price, and photograph. Each of these are set up as TV’s.



    What I would like is to show the latest 2 properties added (Address, Price, and Image) to show on the homepage of the site. I am currently using "[[ListIndexer?LIn_root=7]] " in the template, but all I seem to get is content from other pages.



    Is ListIndexer the best way to go about this, or is there something else which would be better?

    Sorry for my noobness, I have tried for hours to get this to work but had no luck undecided

    Any help would be very much appreciated!

    Thanks in advance.
      • 7923
      • 4,213 Posts
      Ditto would be good for this.. you can use any of the tv’s in it’s template to get the data you want for the listing..

      eg.

      [!Ditto? startID=`7` sortBy=`createdon` sortDir=`DESC` &tpl=`latestPropertiesChunk` &total=`2` &summarize=`all`!]

      and in latestPropertiesChunk, you would have something like:

      <div>
      <p><a href="[~[+id+]~]">[+pagetitle+]</a></p>
      <p><b>Price:</b> [+tvPrice+]</p>
      <p><img src="[+tvImage+]" width=`100` height=`100` alt=`[+pagetitle+]`/></p>
      </div>

      The tv names have to be prefixed with "tv" in Ditto’s template, and you need to of course adjust that output to be what you want, and check the available Ditto parameters as I don’t remember them all.. they are something like that.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 121
        • 36 Posts
        many thanks for the answer mate, but I am going to screeeeeeam undecided

        I have spent ages to get this to work and all I can get to display on the homepage is the Page Title. I have looked around the forum for guidance on chuncks and snippets but cannot find what I am looking for.

        My homepage template contains:

        [!Ditto? &startID=`7` &sortBy=`createdon` &sortDir=`DESC` &tpl=`latestPropertiesChunk` &total=`2` &summarize=`all`!]

        My Chunk (called latestPropertiesChunk) contains this:

        <div>
        <p><a href="[~[+id+]~]">[+pagetitle+]</a></p>
        <p><b>Price:</b> [+tvPropertyPrice+]</p>
        <p><img src="[+tvImage+]" width=`100` height=`100` alt=`[+pagetitle+]`/></p>
        </div>

        My tv’s are called:

        tvPropertyPrice and tvImage (which display fine on the property page below)



        All that appears on the homepage is the title of the page, which is also a link to that property?



        Can anyone please help? Or point me in the direction? I’ll give you a mars bar?
          • 7923
          • 4,213 Posts
          The tv names have only need to be prefixed with "tv" in Ditto’s template..

          So if your tv name is PropertyPrice, then in Ditto template you would use [+tvPropertyPrice+]

          If your tv name is tvPropertyPrice, then in Ditto template you would use [+tvtvPropertyPrice+]


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 121
            • 36 Posts
            excellent Doze, got it working! Many thanks for you help!