Under Construction....
Here is a quick over view of snippets and how you can use them to dynamically pull in the latest listings into your content pages using various search criteria.
Snippets are blocks of code that can be placed into any page by inserting the snippet's name between number symbols. (ie: #snippet#, #other-snippet#, etc.)
For example, I've created the snippet #sample-idx-snippet# which can be seen on this page, http://www.mccannproperties.com/idx-area-test.php.
You can create and manage IDX Snippets from the CMS Backend. http://www.mccannproperties.com/backend/
Creating IDX Snippets
Once logged in, click on "Manage Snippets" from the secondary menu. This brings you to the Snippet Manager.
Look for the snippet labeled #sample-idx-snippet# and select "EDIT". You should now be seeing the form containing the snippet code. I'll go through it line-by-line and explain what it does. Take note that anything following double slashes is commented out.
/* Snippet Settings */
$_REQUEST['snippet_title'] = 'Property Listings in Houstan';
$_REQUEST['snippet_price_table'] = true;
The code above alters the display of the snippet. You can leave these fields empty or comment them out if you'd like. They control the snippet's h1, and price range links. Change these or comment them out to see the effect.
/* Search City */
$_REQUEST['search_city'][] = '41';
You can define one or more area to search using the code above. I've attached a list Notice how every line ends with a semi-colon and values are between single quotes.
All available search values are listed on the IDX search form, http://www.mccannproperties.com/idx/.
/* Search Postal Code */
//$_REQUEST['search_zip'][] = '';
Instead searching by area, you may want to search by postalcode(s). This you can do using the line above.
/* Search by MLS Number */
//$_REQUEST['search_mls'][] = '';
The same applies for MLS Numbers. Use the code above to select results by MLS Number instead of using cities or zip codes.
/* Property Type */
$_REQUEST['search_type'][] = 'SGL'; // single family
$_REQUEST['search_type'][] = 'THC'; // Condos/Townhomes
The above code selects the property type you would like to search. This example searches all Residential Listings. You can un-comment these lines to search by just a single properly class. Note that these values are shortened codes.
/* Price Range */
$_REQUEST['minimum_price'] = 500000;
//$_REQUEST['maximum_price'] = 0;
/* Bedrooms */
//$_REQUEST['minimum_bedrooms'] = 0;
//$_REQUEST['maximum_bedrooms'] = 0;
/* Bathrooms */
//$_REQUEST['minimum_bathrooms'] = 0;
//$_REQUEST['maximum_bathrooms'] = 0;
/* Square Feet */
//$_REQUEST['minimum_sqft'] = 0;
//$_REQUEST['maximum_sqft'] = 0;
/* Year Built */
//$_REQUEST['minimum_year'] = 0;
//$_REQUEST['maximum_year'] = 0;
/* Acres */
//$_REQUEST['minimum_acres'] = 0;
//$_REQUEST['maximum_acres'] = 0;
The block of code above is used to search fields that contain integer values. Minimum Price, Maximum Price, Minimum Bedrooms, Maximum Bedrooms, Minimum Bathrooms, Maximum Bathrooms, Min / Max.Year Built, and Min. / Max. Acres. Simply fill in the number you'd like to search and uncomment the line (remove the "//").
$_REQUEST['page_limit'] = 5;
The last editable line of code is above. This code determines the number of listings to display per page. Enter any number greater than 0.
/** DO NOT EDIT BELOW THIS LINE **/
$_REQUEST['snippet'] = true;
include $_SERVER['DOCUMENT_ROOT'] . '/idx/common.inc.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/idx/inc/php/pages/search.php';
The above lines must not be changed as they include and set the files that are used to pull in the IDX listings.
When you want to create a snippet, simply copy this code and create a new snippet, editing the code as desired.
Using IDX Snippets
Another important note for when using IDX snippets, be sure to use the #snippet-top# and #snippet-bottom#. These snippets are used to wrap content in so it will only display on the main area page. This gets rid of duplicate content on the price range pages or the rest of the listing result pages. Check out the hidden test page in the CMS and you'll see how these snippets are used.
http://www.mccannproperties.com/idx-area-test.php http://www.mccannproperties.com/idx-area-test.php?page=2 http://www.mccannproperties.com/idx-area-test/200000-300000/
Example Usage:
#snippet-top#
Area Heading
We are the top choice Area Realtor.
#snippet-bottom#
Area Listings updated Daily.
#mls-area-snippet#
The content between the #snippet-top# and #snippet-bottom# snippets will not be displayed on the rest of listing result pages.
When using these snippets, you must include both snippets on the page. The top snippet must be before the bottom snippet, or an error will occur.
Well that's quite a bit... I hope all this makes sense! Let me know if you have any questions or come across any trouble.
If you would like to add more search fields to the snippets, send over a list to your sales rep, and he/she will be able to get things added to the project and into the queue for you.
Rice Village Condos |