We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3689
    • 264 Posts
    I’m creating a Real Estate website and this is one thing I cant figure out.. I have a page at site.com/properties listing about 6 homes that are for sale but what would be the best way to display the featured home on the home page (site.com)? How could I set that up?

    I thought about a TV that would determine if a home is featured.. would only work on 1 home but this kind of seems like alot of work.. I could be makin this alot more difficult than it has to be so does anyone have any suggestions?
      • 4310
      • 2,310 Posts
      I usually have a "Promote to Home Page" checkbox TV.
      Then use Ditto e.g.
      [!Ditto? &startID=`0` &display=`1` &tpl=`home_property_template` &randomize=`0` &depth=`3` &tagDelimiter=`,` &filter=`promote_home,1` &noResults=`No Properties Found`!]
        • 3689
        • 264 Posts
        Quote from: bunk58 at Jan 30, 2010, 07:10 AM

        I usually have a "Promote to Home Page" checkbox TV.
        Then use Ditto e.g.
        [!Ditto? &startID=`0` &display=`1` &tpl=`home_property_template` &randomize=`0` &depth=`3` &tagDelimiter=`,` &filter=`promote_home,1` &noResults=`No Properties Found`!]

        I kind of understand how this works.. so say I have 5 different homes.. what if 1 home is promoted to the home page and I have try to promote another? I’m just tryin to think of all the possibilities to make it as easy as possible 4 the client.. i would try it out but im not home right now.. but it looks like what im lokoin for smiley
          • 4310
          • 2,310 Posts
          &display=`1`
          Will limit the output to one, even if your client has more than one selected.
            • 3689
            • 264 Posts
            Quote from: bunk58 at Jan 31, 2010, 06:26 AM

            &display=`1`
            Will limit the output to one, even if your client has more than one selected.

            It works, but say if I have Home1 currently featured no the Homepage and I decide to promote Home3 to the homepage.. Home1 will still be on "Yes" for the radio selections.. is there a way to get it reset back to "No" so if I want to feature Home1 on the homepage I dont have to click "No" and then click "Yes"?
              • 4310
              • 2,310 Posts
              I suppose a new plug-in could be triggered on doc form save to set all the other promote home TV values to 0
                • 27442
                • 103 Posts
                If each home is set as in individual document, you should be able to apply a TV to the home page that uses an @DOCUMENT or even an @SELECT binding. Each time you choose a new featured home it would replace the previous one with no worries about having more than one because of TV’s in the individual home documents.
                  • 3689
                  • 264 Posts
                  im not good with php so not sure how to do the other solution yet but what is a @DOCUMENT/@SELECT binding? im not sure if its an easier solution, but id like to try anythin out
                    • 3749
                    • 24,544 Posts
                    @SELECT requires a MySQL statement to pull a selection from the database. @DOCUMENT is much simpler, it’s just a reference to a document at the site (by document ID). With @DOCUMENT, the content field of the specified document replaces the TV tag.

                    Here’s a cool way to use @DOCUMENT. Let’s say the IDs of the featured houses are 1, 2,and 3. The Input Option values of the TV on the home page could look like this:

                    323 Maple==@DOCUMENT 1||213 Pine==@DOCUMENT 2||923 Elm==@DOCUMENT 3


                    Format the TV as a drop-down list or as radio options. The user will see this:

                    323 Maple
                    213 Pine
                    923 Elm

                    but the TV tag will be replaced by the @DOCUMENT part which will be replaced by the content of document containing the property the user selects.

                    If you really want to get fancy, you could actually use an @EVAL statement with runSnippet() and create a snippet that would generate the Input Option Values drop-down list from all the houses in a particular container (or tagged in some way -- e.g. with another TV called "Featured"). Of course, you could also rotate the featured houses at random. Is MODx cool or what?



                      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
                      • 26931
                      • 2,314 Posts
                      you can use Quill for this

                      http://modxcms.com/extras/package/?package=355

                      1. install the snippet
                      2. create a TV e.g. "feature", "Dropdown List Menu", Input Option Values: @EVAL return $modx->runSnippet(’Quill’, array("parent"=>"11")); with 11 being the id of my parent folder to retrieve documents from
                      3. assign it to your template
                      4. on your startpage you can call Ditto like this: [[Ditto? &documents=`[*feature*]` &extenders=`summary` ... etc ]]

                      5. your TV "feature" will list all available documents to choose from

                      this is quite handy smiley

                      solves this problem:
                      what if 1 home is promoted to the home page and I have try to promote another? I’m just tryin to think of all the possibilities to make it as easy as possible 4 the client

                      *edit: ddTree Snippet could work as well:
                      http://modxcms.com/extras/package/90
                      http://www.modxcms.com/forums/index.php?topic=19614