Custom search form with Jumi
First unread post • 2 posts
• Page 1 of 1
Custom search form with Jumi
Hi
I want to create a custom search form using Jumi.
This form should contain input boxes for name surname so I can search by these two fields.
I want to use this two fields in a SQL query so I can output my results with an extension I purchased ArtData.
Can you help me with some code ?
Regards
I want to create a custom search form using Jumi.
This form should contain input boxes for name surname so I can search by these two fields.
I want to use this two fields in a SQL query so I can output my results with an extension I purchased ArtData.
Can you help me with some code ?
Regards
- drunkenphd
- Posts: 1
- Joined: Tue Jan 28, 2014 6:43 pm
Re: Custom search form with Jumi
Try something like this:
Put this code in a page :
In a second page (pagetoshowresults.html) write something like this:
I suggest you sphinx search engine. (look here: http://www.bikeshopitalia.com/search-engine.html)
Bye
Fabio
Put this code in a page :
- Code: Select all
<form action="/pagetoshowresults.html" method="get" id="search">
<p><input tye="submit" type="text" value="<? echo htmlentities($q); ?>"/ name="q" placeholder="search here..." width=600px /></p>
In a second page (pagetoshowresults.html) write something like this:
- Code: Select all
<?
$q = isset($_GET['q'])?$_GET['q']:'';
if (empty($q)) {
echo "You Search string is empty";
}
else {
$db = JFactory::getDbo();
$query= "SELECT * from YOURTABLE where WHATAREYOULOOKINGFOR like '%$q%'";
// THE QUEY IS VERY PERSONAL. YOU SHOULD USE 'LIKE', OR '=' OR 'MATCH AGAINST' METHOD
$db->setQuery($query);
$results = $db->loadObjectList();
foreach ($results as $prod) {
echo $title = ($prod->title);
echo $ID = ($prod->ID);
// HERE YOU NEED TO PARSE THE RESULTS
}
?>
I suggest you sphinx search engine. (look here: http://www.bikeshopitalia.com/search-engine.html)
Bye
Fabio
- fiegri
- Posts: 4
- Joined: Mon Feb 25, 2013 8:57 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest