ajax-live-search
ajax-live-search copied to clipboard
Template setting
Hi,
I cannot figure out how to do these two things:
-
remove footer from search. I found in .js file function and tried to use it but it doesnt work. Can you provide some example how to use these functions?
-
set output like this [ IMAGE ] [ NAME ] [ ... ]. Output is done within foreach loop if I understand correctly. I was planning to implement that with IF statement so if ($columnName === 'image') then insert
<img src="databaseOutput">
inside<td>
. Is this good?
Thank you for this great plugin!
Cheers! Aleksandar
Hi,
second thing is done but couldnt figure out how to remove footer from search. Currently not so good solution is to limit search output to 5 items so footer cannot show.
Thanks again for this great plugin!
Cheers! Aleksandar
Hi its kinda easy, the only file you nede to edit is default.php
*/ if (!empty($rows)) {
foreach ($rows as $row) {
$html .= '<tr>';
foreach ($row as $columnName => $column) {
if($columnName == 'id') {
$columnId= $column;
}
if($columnName == 'name') {
$columnProductname= $column;
}
if($columnName == 'productimage') {
$columnProductimage= $column;
}
if($columnName == 'producturl') {
$columnProducturl= $column;
$html .= "<td><img src='https://pathtoimage.com/$columnProductimage' class='imagevsearchi' style='width: 50px;height: auto;margin-right: 10px;'><a href='../produkt/{$columnProducturl}&id={$columnId}'>{$columnProductname}</a></td>";
}
}
$html .= '</tr>';
}
} else { // No result
// To prevent XSS prevention convert user input to HTML entities
$query = htmlentities($query, ENT_NOQUOTES, 'UTF-8');
// there is no result - return an appropriate message.
$html .= "<tr><td>Nenašli jsme žádné výsledky</td></tr>";
}
return $html;