Updating Error

Come here for help or to post comments on Sphider
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk »

Okay... that was trial and error, but I have it working. Not quite as simple, but still better than duplicating EVERYTHING.

Lines 61-67... ALMOST my way...
This works:
$include_dir = "./include";
$template_dir = "./templates";
$common_template_dir = "./common_template";
$tmp_dir ="../sphider/tmp";
$settings_dir = ".settings";
$language_dir = "../sphider/languages";
$calendar_dir = "../sphider/calendar";
Lines 61, 62 63 and 65 reverted to the original paths.
That is all the needs to be done to search.php in the es_search directory.

The following directories need to be copied from sphider to es_sphider:
sphider/common-template --> es_search/common-template
sphider/js-suggest --> es_search/js_suggest
sphider/include --> es_search/include
sphider/settings --> es_search/settings
sphider/templates --> es_search/templates
Also copy sphider-logo.png from sphider to es_search.

In the es_search/include directory, you may delete common.txt and simple_html_dom.php.
None of the copied files need any editing.

Now THAT works! Ask me WHY just changing the paths doesn't work and I'll say "Darned if I know --- YET!". I'm sure once I figure that out I'll be giving myself a head slap, but for right now I AM puzzled. Testing this got a bit crazy because doing this trial and error, I would delete a file and see if it still worked. It would work fine... work fine... work fine... then stop working. WHAT?! Then I realized there is this little thing called cache. So after each change I would need to not just test, but REFRESH, and THEN test.

As I said... I am puzzled why I can change the language path, but not the template path, or the include path? There IS a logical explanation, I just don't know what it is yet.
SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow »

I will test this out a bit later. Actually my primary use is for a site in Spanish, but easy enough to tweak your suggestions appropriately. I will follow up and let you know how it goes and respond to your other post about language as I do have some thoughts on that.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk »

I dreamed up another solution last night which I will test today. It is for a very simple MOD and will not require any separate directories or copied files. Essentially, it will involve adding a command-line variable to override any language setting.

I'll post later, presuming the idea works.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk »

The idea I dreamed up last night works! You can see the details in the Sphider MOD board on this forum. W-A-Y cleaner solution than my first attempt. No need to copy files or create new directories.

Search.php works just like it did originally, except that by adding ?sl=[language] you can get a search in the language of your choice (provided there is a language file for that). The change then persists either until the end of the session (you close your browser) or you issue a parameter specifying another language.

You can provide multiple variations of the links on a single web page and there will not interfere with each other, since it will be a client you clicks on one of those links being the one who sees the change.
SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow »

So I had not looked back here before I started digging into things on my end and went the route of a similar solution you added on. Not likely as clean and minimal as yours but it also involved just moding some files.

So I created a second search.php form page and also search_form.php page just to make sure it pointed to my new search.php page. Within search I hard coded the $language variable to 'en' in the appropriate places after the value would have been pulled from conf.php.

This also avoided the whole new directory approach.

If you are interested in seeing the end result let me know and I will post where it is located.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk »

I am ALWAYS interested in other approaches to a problem! I would love to take a peek at what you've come up with.
SphiderSnow
Posts: 17
Joined: Mon Dec 10, 2018 8:41 pm

Re: Updating Error

Post by SphiderSnow »

So I use Sphider within the framework of my site so I already tweak a bit on file names and content. That said, you can go here to see how it is used - www.createch.cl

That will bring you to the Spanish page which is the main one for the business. On all our pages we have the small search area on the right side of the menu bar. You can also switch to English on the top menu bar. To make it work for both languages this time scaled back from a double folder setup which was always overkill but done as an initial quick fix, and I combined that with what we were working through to modify just two Sphider related files.

The first was modifying search.php (which of course had a new name) to include $language = "en"; right after each time require $settings_dir."/conf.php"; was run. I also redirected to a second search_form file which made sure to pull the english version of the search.php file.

We will be doing a more mobile friendly site in the next few months so I will try to incorporate the mod you put together then. Thanks for all your help in getting things running. Do you have some way setup to support your efforts? I did not see one but may have missed it.
User avatar
captquirk
Site Admin
Posts: 299
Joined: Sun Apr 09, 2017 8:49 pm
Location: Arizona, USA
Contact:

Re: Updating Error

Post by captquirk »

When you do go more mobile friendly, Sphider is already a good way there with the mobile template css. The mobile template is basically the standard with different css. From the looks of it, you are already basing your results page on either the standard and/or mobile template as it is.

Sphider 2.2 forces the mobile template on mobile users (as you likely saw in search.php). I have started work on 2.3, in which ALL templates will have css that adapts between mobile and conventional. That should simplify the incorporation of template features into a sites customized results page.

As to my efforts: I was using Sphider on my own site when about three years ago ever evolving PHP and MySQL began causing problems with Sphider. Sphider was no longer being updated, so my choices were to live with it (not really an option), look for another similar search engine (for a hobby site I wasn't big on paying and there really weren't any other options), or fix it. I did the latter, and after a couple iterations actually started getting something usable. I have chosen to share what I have come up with. I'm not out for a buck, so I'm not going to charge anything. And I don't feel comfortable asking for donations. The "team" consists of me, myself, and I, and "we" maintain Sphider because it gives "us" something to do. :D (We have cats, so a rocking chair wasn't a viable option.)
Post Reply