
<?php
$val = $_GET['querystring']; // http://your-url?&querystring=some-value
$output = '';//create variable for holding the output
$sql = $modx->db->query( 'SELECT * FROM `tblprojects` WHERE `some_column` = \''.$val.'\' LIMIT 0, 1000');//define the DB query, in this case the table is named 'tblprojects', and 'some_column' is your field name
$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['award']=$item['Grant_Award'];//set the placeholders, the $params sets the name of the placeholder, the $item is the field name from the DB table
$params['ref']=$item['Project_Ref'];
$params['area']=$item['LA_Area'];
$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
?>
<?php
/* Url_Seperator
*/
// url seperator placeholder ///////////////////////////////
if($modx->config['friendly_urls'] =="1"){
$seperator ="?";
}else{
$seperator ="&";
}
$modx->setPlaceholder('url_sep',$seperator); // [+url_sep+]
?>