homepage Welcome to WebmasterWorld Guest from 54.227.141.230
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

This 43 message thread spans 2 pages: 43 ( [1] 2 > >     
Functional search box
ghid




msg:4595063
 4:04 pm on Jul 21, 2013 (gmt 0)

Hi,

I have some knowledge in HTML,PHP and CSS, and I want to implement a functional
search box on a syte and I don't know where to start.

I want that the search to be made whithin my site content.

Please help me to do that.

Thank you in advance.

 

brotherhood of LAN




msg:4595064
 4:13 pm on Jul 21, 2013 (gmt 0)

ghid, how big is your site?

If Google has your site well spidered, particularly if you don't add lots of new pages... then using their search may be good enough [google.com...]

ghid




msg:4595066
 4:23 pm on Jul 21, 2013 (gmt 0)

But you have to pay if you exceed 100 searches? Isn't it so?
I want a free option please.

Thank you.

brotherhood of LAN




msg:4595067
 4:29 pm on Jul 21, 2013 (gmt 0)

Wow, never realised they charge for that.

There will be free options, but depending on your confidence of using PHP, there are a number of PHP libraries you could use, sphinx being oft mentioned.

ghid




msg:4595072
 4:48 pm on Jul 21, 2013 (gmt 0)

I am disposed to learn. I will read about this sphinx library. Thank you for the start point gived by you.

ghid




msg:4595074
 5:01 pm on Jul 21, 2013 (gmt 0)

Using sphinx I have to upload my content in a database?

lucy24




msg:4595100
 9:17 pm on Jul 21, 2013 (gmt 0)

Wow, never realised they charge for that.

Do they? My understanding was that it's always free if you let them show advertising; you have to pay to eliminate the ads.

brotherhood of LAN




msg:4595101
 9:21 pm on Jul 21, 2013 (gmt 0)

You could be right lucy, I always thought there was a free option as it's so prevalent. It was my first thought of a suggestion for ghid to have a look at.

bhukkel




msg:4595103
 9:24 pm on Jul 21, 2013 (gmt 0)

Yes it is absolute free, i use CSE and have >100 queries a day. Only Google Site Search is a paid option. No ads are displayed and there is an API and XML interface.

swa66




msg:4595106
 9:36 pm on Jul 21, 2013 (gmt 0)

I've been using CSE linked to my adsense account for years. Never paid a penny, on the contrary, Google pays me ... (not that much)

ghid




msg:4601092
 4:11 pm on Aug 11, 2013 (gmt 0)

Hi!

I have made a new site and implemented the google custom search on it.
When I typed a word or a group of words from my site ( this site consists in just one page ) the result displayed was nothing.
It is because de google didn't indexed my site or why?

londrum




msg:4601094
 4:36 pm on Aug 11, 2013 (gmt 0)

google search only returns the pages that are in google's index, i believe. installing the custom search doesn't make them spider it anymore than they normally would. that was a deal breaker for me, because my site is thousands of pages and half of them might drop out of the search making it look like they don't exist.

there's an open source script that's been around for years, called "sphider". that's what i've been using. you'll need a database to install it, but it can spider you whole site and even has a few logs so you can see what's being searched for. the templates are totally customisable too.

ghid




msg:4603317
 4:25 pm on Aug 19, 2013 (gmt 0)

Thank you londrum for your response.
I downloaded and installed sphider following the steps posted on the sphider site and I can't make it working.

I have tested it on my own local PC Apache and Mysql servers.

And it shows me errors.

- When I enter the sphider search page
" http://localhost/sphider/search.php"

are displayed in page next to the search form the following two messages:


SELECT count(*) FROM categories WHERE parent_num=0
Table 'sphider.categories' doesn't exist


and



SELECT * FROM categories WHERE parent_num=0 ORDER BY category
Table 'sphider.categories' doesn't exist



Please help me if you can.

Thank you.

[edited by: phranque at 7:31 pm (utc) on Aug 19, 2013]
[edit reason] unlinked url [/edit]

londrum




msg:4603381
 7:48 pm on Aug 19, 2013 (gmt 0)

have you got phpmyadmin, or something like that? check that the categories table exists. if it doesnt then just create it manually (have a look at the sphider install script to see which fields you need to add)

ghid




msg:4603398
 8:23 pm on Aug 19, 2013 (gmt 0)

I had readed in sphider forum that I have to install sphider again
I had installed again and when I access search.php doesn't apear any error, but when I press search button appears the following error:



Table 'sphider.query_log' doesn't exist



I will take a look in install.php to more digging.

Thank you.

ghid




msg:4605836
 5:57 pm on Aug 29, 2013 (gmt 0)

About the error -> " Table 'sphider.query_log' doesn't exist "
I have readed in the Spider forum that this error had appeared because the size of the column " time timestamp(14) " was to big, so I chaghed in the install.php time timestamp(14) with timestamp(6) and solved appearing of this error and I hope that my change to not affect good functioning of this application

I have idexed my localhost site but searching doesn't works. After a search this message appears: The search "home" did not match any documents.

Please help me to set up sphider. Thank you.

ghid




msg:4605838
 6:29 pm on Aug 29, 2013 (gmt 0)

Problem solved. I had less than 10 words and my site wasn't indexed.
I hope to have succes with custom dysplayng because at he result search it apears all page, and the searched word is not highlighted.

londrum




msg:4605858
 7:34 pm on Aug 29, 2013 (gmt 0)

it takes a bit of fiddling with, like most open source stuff. but its definitely worth persevering with. it's a good little search script once you get it up and running, and the stats are handy too, so you can see what people are having trouble finding on your site

ghid




msg:4606025
 5:33 am on Aug 30, 2013 (gmt 0)

Thank you very much on your advice of using this search script, because I don't like at all google custom search and nobody gived me alternatives ( with except of a sphinx php library.

Two quickly qwestions before I start to study the problem:

-The search result can be customized? The searched words can be highlighted, bordered e.t.c on the displaing search page?

- It is difficult of online implementing? ( because now I test it on localhost server)

Thank you very much.

ghid




msg:4606527
 6:26 am on Sep 1, 2013 (gmt 0)

Why I can't include the search.php of sphider within a div from my page? It is a common problem?

londrum




msg:4606552
 8:43 am on Sep 1, 2013 (gmt 0)

i haven't even got a search.php file. my main page is index.php
what is it, the results page? or just a little search box?

if it's just a search box then you don't really have to include the file, just copy the search box code straight into your main page. as long as the search form leads to the same page in the end, thats all that matters

if it's the result page, then just amend the search.php file directly, and include all your headers and sidebars, or whatever, around it. pretend that it is just a template file

ghid




msg:4606560
 10:16 am on Sep 1, 2013 (gmt 0)

It is a search php page that displays a search box but it have a lot of code in that page, it is a code that I don't understand, it's complicated to me, I think is a php database code.

I tried to copy this code inside a div of my index page, but it has no effect.

londrum




msg:4606563
 10:53 am on Sep 1, 2013 (gmt 0)

actually, i remember now... i think i renamed my search.php page as index.php

but that search.php is just a standalone page, which shows the search results, is that right?

just pretend that it is a normal page, and include all your html inside it -- including all the <head> and <body> stuff, and then find and remove the lines which call the template files. that is what i did i think

ghid




msg:4606567
 11:13 am on Sep 1, 2013 (gmt 0)

yes, it is a standalone php page. It is an ideea to start constructing my page after it, but why I can't include it in my site with this code <?php include("/path/search.php") ?>

londrum




msg:4606569
 11:26 am on Sep 1, 2013 (gmt 0)

its probably because its got a load of php headers in it, and you cant call those after you have already written some stuff to the page (which you would have done in the page that "included" it)

try turning on php errors, and then you will be able to see exactly why its not working

ghid




msg:4606582
 1:49 pm on Sep 1, 2013 (gmt 0)

And how I do that? How I turn PHP erors on?

londrum




msg:4606583
 2:13 pm on Sep 1, 2013 (gmt 0)

put these two lines at the very top of the .php file (before anything else is written)

error_reporting(E_ALL);
ini_set('display_errors', 1);

if you are including the search.php page in another file, then it needs to go at the top of the other file

ghid




msg:4606587
 2:58 pm on Sep 1, 2013 (gmt 0)

I have to pot these within a php statment?

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

?>

ghid




msg:4606588
 3:01 pm on Sep 1, 2013 (gmt 0)

It had needed with php statments :)

ghid




msg:4606797
 6:00 pm on Sep 2, 2013 (gmt 0)

Man, I'm struggling and I'm struggling again, it's out of my league, but I'm not giving up, please help me.


I had activated the php errors, and so, the errors has comed:

I will post just the first error:

Warning: include(./include/commonfuncs.php) [function.include]: failed to open stream: No such file or directory in C:\Server\Apache2\htdocs\clothes.php on line 118

I finded the comonfucs.php file and I replaced the path with /localhost/sphider/include/comonfuncs.php

and the error has become:

Warning: include(localhost/sphider/include/commonfuncs.php) [function.include]: failed to open stream: No such file or directory in C:\Server\Apache2\htdocs\clothes.php on line 118

Those errors appears in my clothes.php where I had integrated the content of search.php page

Why this error appears?

This 43 message thread spans 2 pages: 43 ( [1] 2 > >
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved