I need my users to view a list of real estate properties (addressess) in a multi-select TV, select several of these, and then use the unique id of each property to display what will be the "featured listings" on the home page.
I can get values from the database into my TV but it’s all on one line....can someone tell me how to properly delineate these?
Here’s what I have so far:
1. A TV call "GetProperties" that is a Listbox (Multi-Select) with an input option value of @EVAL return $modx->runSnippet(’PropertyListbox’);
it looks like this:
http://cl.ly/163I0r38113z3G0L3X0U
2. A Snippet called PropertyListbox that looks like this:
<?php
$output = '';//create variable for holding the output
$sql = $modx->db->query( 'SELECT * FROM `mls_listings` LIMIT 0, 500');//define the DB query, in this case the table is named 'tblprojects', add WHERE AND etc. as needed
$resultArray = $modx->db->makeArray( $sql );//put it into an array
foreach($resultArray as $item)//go through each record in the array
{//start looping through the data array
$params['housenumber']=$item['C_HHouseNumber'];//set the placeholders, the $params sets the name of the placeholder, the $item is the column name from the DB table
$params['streetname']=$item['C_StreetName'];
$params['streettype']=$item['C_StreetType'];
$params['uniqueID']=$item['C_Matrix_Unique_ID'];
$output.=$modx->parseChunk('ProjectTpl', $params, '[+', '+]');//define the chunk name and process the content, here it's ProjectTpl which has the placeholders for the data
}//finish looping through the data array
return $output;//now return the output from the processed chunk
?>
3. A Chunk "ProjectTpl" that looks like this:
[+housenumber+] [+streetname+] [+streettype+][+uniqueID+]II
Note that I was trying to use the II to get all of the values displaying properly in the resource TV but no luck. Can someone see where I’m going wrong?
....and finally my brain is fuzzy on how I’m going to pass the uniqueID to the homepage for processing.
Thanks for taking the time to read this.