Ok, I’m trying to mod AjaxSearch 1.7.1 so I can search for data in a remote database, then return the results as the original script intended. It sounded easy in my head but I’ve been trying to get it working for a few hours and I’m running out of ideas why it’s not working..
This is what I’ve done so far :
snippet.ajaxSearch.inc.php
$resultPlaceholders = array(
'[+as.test+]' => 'teseeeeest',
'[+as.resultClass+]' => 'ajaxSearch_result',
'[+as.resultLinkClass+]' => 'ajaxSearch_resultLink',
'[+as.resultLink+]' => $searchFormLink,
'[+as.longtitle+]' => $SearchFormsrc['Name'],
'[+as.pagetitle+]' => $SearchFormsrc['FileName'],
'[+as.description+]' => $resultDesc,
'[+as.extract+]' => $resultExtract,
);
then
ajaxSearch.inc.php
// Connect to remote db
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
$dbname = 'Sharedb';
mysql_select_db($dbname);
$sql = "SELECT * from files WHERE FileName LIKE '%$searchTerm%'";
$rs = $modx->db->query($sql);
mysql_close($conn);
return $rs;
now for
templates.inc.php
'result' => '
Name : [+as.longtitle+]
Filename : [+as.pagetitle+]
Test : [+as.test+]
</div>'
All I get is no data in [+as.longtitle+] and [+as.pagetitle+] but [+as.test+] shows up as "[+as.test+]" not teeeeest
any kinda of help on this would be cool, thanks for reading.
Regards, Will7am.