We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7371
    • 22 Posts
    I've been trying to get a list of properties to show using GetResource and MIGx (MIGx is to keep the tv's combined).

    My Property listing page has this GetResource code on:

    [[!getResources? 
    &tpl=`Property Listing Style Chunk` 
    &parents=`[[*id]]`
    &showHidden=`1` 
    ]]
    


    My Property Listing Style Chunk is this:

    [[!getImageList? &tvname=`Portland Properties` &tpl=`Property Listing Style` &docid=`[[+id]]`]]
    


    And my Property Listing Style Chunk is this:

    <div class='property span3'>
        <div class='image'>
            <div class='content'>
                <a href='[[~[[+id]]]]'></a>
                [[!If? &subject=`[[+image]]` &operator=`notempty` &then=`<img alt='[[+pagetitle]]' src='[[+image]]'>` &else=`<img alt='[[+pagetitle]]' src='default'>`]]
            </div>
            [[!If? &subject=`[[+price]]` &operator=`notempty` &then=`<div class='price'>£[[+price]]</div>`]]
        </div>
    
        <div class='title'><h2><a href='[[~[[+id]]]]'>[[!If? &subject=`[[+address]]` &operator=`notempty` &then=`[[+address]]`]]</a></h2></div>
    
        <div class='location'>[[!If? &subject=`[[+town]]` &operator=`notempty` &then=`[[+town]]`]][[!If? &subject=`[[+county]]` &operator=`notempty` &then=`, [[+county]]`]]</div>
        [[!If? &subject=`[[+beds]]` &operator=`notempty` &then=`<div class='bedrooms'><div class='content'>[[+beds]]</div></div>`]]
        [[!If? &subject=`[[+baths]]` &operator=`notempty` &then=`<div class='bathrooms'><div class='content'>[[+baths]]</div></div>`]]
    </div>
    



    Now everything is working fine http://www.hgh.digibug-dev.co.uk/properties/portland-properties/ but as you'll see only the first of the properties shown will link through to the details page... I've absolutely no idea why. Also the alt text is only showing on the first as well.

    Here is the source code that is output:

    <div class='property span3'>
        <div class='image'>
            <div class='content'>
                <a href='properties/portland-properties/new-property.html'></a>
                <img alt='New Property' src='00-website-images/floor-plans.jpg'>
            </div>
            <div class='price'>£1000</div>
        </div>
    
        <div class='title'><h2><a href='properties/portland-properties/new-property.html'>Address</a></h2></div>
    
        <div class='location'>Town, County</div>
        <div class='bedrooms'><div class='content'>3</div></div>
        <div class='bathrooms'><div class='content'>2</div></div>
    </div>
    <div class='property span3'>
        <div class='image'>
            <div class='content'>
                <a href=''></a>
                <img alt='' src='00-website-images/weymouth-office.jpg'>
            </div>
            <div class='price'>£12</div>
        </div>
    
        <div class='title'><h2><a href=''>8</a></h2></div>
    
        <div class='location'>9, 10</div>
        <div class='bedrooms'><div class='content'>13</div></div>
        <div class='bathrooms'><div class='content'>14</div></div>
    </div>
    <div class='property span3'>
        <div class='image'>
            <div class='content'>
                <a href=''></a>
                <img alt='' src='00-website-images/sale-board.jpg'>
            </div>
            <div class='price'>£5</div>
        </div>
    
        <div class='title'><h2><a href=''>1</a></h2></div>
    
        <div class='location'>2, 3</div>
        <div class='bedrooms'><div class='content'>6</div></div>
        <div class='bathrooms'><div class='content'>7</div></div>
    </div>
    <div class='property span3'>
        <div class='image'>
            <div class='content'>
                <a href=''></a>
                <img alt='' src='00-website-images/portland-office.jpg'>
            </div>
            <div class='price'>£120000</div>
        </div>
    
        <div class='title'><h2><a href=''>Test Property</a></h2></div>
    
        <div class='location'>Exeter</div>
        <div class='bedrooms'><div class='content'>3</div></div>
        <div class='bathrooms'><div class='content'>1</div></div>
    </div>
    
    



    Help, i'm losing my mind!!!
      • 4172
      • 5,888 Posts
      try:

      [[~[[+property.docid]]]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 7371
        • 22 Posts
        Bruno your awesome, thank you so much.
        Just sent you some beer money, MIGx is amazing!!!

        One quick question, is this the best way to do what I'm doing? I was originally going to try and pop all the properties into one a single property page with MIGx running but couldn't seem to find any way to link through and show more information i.e. the property details page.

        Thanks again.
          • 4172
          • 5,888 Posts
          Hey digibug,
          Thanks for the beer!

          I think, I would do it a bit different.
          I would use one Resource for each property, if not put them in a custom-table.
          I would store all the property-informations into TVs of the property-resource and use MIGX just for the property-images.

          To get the first image with the Link into the listing you would do something like that in the getResources-tpl:
          <div class='property span3'>
              <div class='image'>
                  <div class='content'>
                      <a href='[[~[[+id]]]]'>
                      [[getImageList? &limit=`1` &tvname=`images` &tpl=`property_images` &docid=`[[+id]]`]]
                      </a>
                  </div>
                  [[If? &subject=`[[+tv.price]]` &operator=`notempty` &then=`<div class='price'>£[[+tv.price]]</div>`]]
              </div>
           
              <div class='title'><h2><a href='[[~[[+id]]]]'>[[If? &subject=`[[+tv.address]]` &operator=`notempty` &then=`[[+tv.address]]`]]</a></h2></div>
           
              <div class='location'>[[If? &subject=`[[+tv.town]]` &operator=`notempty` &then=`[[+tv.town]]`]][[!If? &subject=`[[+tv.county]]` &operator=`notempty` &then=`, [[+tv.county]]`]]</div>
              [[If? &subject=`[[+tv.beds]]` &operator=`notempty` &then=`<div class='bedrooms'><div class='content'>[[+tv.beds]]</div></div>`]]
              [[If? &subject=`[[+tv.baths]]` &operator=`notempty` &then=`<div class='bathrooms'><div class='content'>[[+tv.baths]]</div></div>`]]
          </div>
          


          And I would call all snippets cached.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!