Hi,
I am creating search page.
How to search whole site content and html pages?
On my "searchResults.php"
Header area:
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home2/ehost6/public_html/unicomp.com.tw/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }
// load record from 'training'
list($trainingRecords, $trainingMetaData) = getRecords(array(
'tableName' => 'training',
'where' => whereRecordNumberInUrl(0),
'loadUploads' => true,
'allowSearch' => true,
));
?>
Note : Now is //load record from "training". How to load whole site record & html pages?
Search field:
<div class="search-box">
<form action="searchResults.php" method="get" name="search_form" id="search_form">
<input name="title,keyword" id="q" type="text" class="search-field" value="搜尋" />
<input src="icon/search_btn.gif" name="btn_search_submit" id='btn_search_submit' type="image" />
</form>
</div>
searchResults.php (HTML area) :
<?php foreach ($productsRecords as $record): ?>
</p>
<table border="0" cellspacing="0" cellpadding="0" width="700">
<span
id="news_list_lab">
<tbody>
<tr>
<td align="left" valign="top" class="content"><b> <a href="<?php echo 'products-detail.php?num='.$record['category'];?>">
<?php echo htmlencode($record['title']) ?> </a> </b> <?php echo $record['intro']; ?></td>
</tr>
</tbody>
</span>
</table>
<p>
<?php endforeach ?>
Note:
This is code sample.
The "productsRecords" is from my previous site code.
I have no idea what code I can instead to display search result.
Hello, I hope someone out there can help.
Thanks!
Jac
-Jax H.