Author Topic: Search feature?  (Read 6045 times)

0 Members and 1 Guest are viewing this topic.

Offline Vhaeos

  • Pre-Newbie
  • Posts: 4
    • View Profile
Search feature?
« on: February 17, 2006, 09:54:27 PM »
Well, sorry in advance if this has been asked before and I skimmed over it. I tried searching a bit, but nothing seemed to pop up.

Anyway, I was curious if there was anyway to make it so searches could be linkable. Like, I could make a search, and then post a link to it here, then if anyone clicked on that link, they'd see what I searched for. At the time, I don't think that's possible. (Hopefully I'm wrong.)

Either way, thanks in advance.

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Search feature?
« Reply #1 on: February 18, 2006, 12:07:58 AM »
As i know, 4images doensn't store any searches,
i know only a mod from vano, which gives you an search statistic.
Btw: Why do you need that?
In forums/boards i can understand, but in an gallery system?
Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline TheOracle

  • Hero Member
  • *****
  • Posts: 875
    • View Profile
Re: Search feature?
« Reply #2 on: February 18, 2006, 12:20:31 AM »

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Search feature?
« Reply #3 on: February 18, 2006, 12:55:09 AM »
1) make sure you applyed all bug fixes that you can find from the link in my sig.
2) in search.php find:
Code: [Select]
if (isset($HTTP_POST_VARS['search_terms'])) {
  $search_terms = (trim($HTTP_POST_VARS['search_terms']) == "all") ? 1 : 0;
}
else {
  $search_terms = 0;
}

if (isset($HTTP_POST_VARS['search_fields'])) {
  $search_fields = trim($HTTP_POST_VARS['search_fields']);
}
else {
  $search_fields = "all";
}

$search_cat = (isset($HTTP_POST_VARS['cat_id']) ) ? intval($HTTP_POST_VARS['cat_id']) : 0;
Replace with:
Code: [Select]
if (isset($HTTP_POST_VARS['search_terms']) || isset($HTTP_GET_VARS['search_terms'])) {
  $search_terms = ((isset($HTTP_POST_VARS['search_terms']) && trim($HTTP_POST_VARS['search_terms']) == "all") || (isset($HTTP_GET_VARS['search_terms']) && trim($HTTP_GET_VARS['search_terms']) == "all")) ? 1 : 0;
}
else {
  $search_terms = 0;
}

if (isset($HTTP_POST_VARS['search_fields']) || isset($HTTP_GET_VARS['search_fields'])) {
  $search_fields = (isset($HTTP_POST_VARS['search_fields'])) ? trim($HTTP_POST_VARS['search_fields']) : trim($HTTP_GET_VARS['search_fields']);
}
else {
  $search_fields = "all";
}

$search_cat = (isset($HTTP_POST_VARS['cat_id']) || isset($HTTP_GET_VARS['cat_id'])) ? (isset($HTTP_POST_VARS['cat_id']) ? intval($HTTP_POST_VARS['cat_id']) : trim($HTTP_POST_VARS['cat_id'])) : 0;

Then in search form (in search_form.html template and/or any other templates where you have search form) replace method="POST" with method="GET"
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline IcEcReaM

  • Hero Member
  • *****
  • Posts: 714
    • View Profile
    • My little Testboard
Re: Search feature?
« Reply #4 on: February 18, 2006, 01:46:08 PM »
ok, this is a workaround you can do it also with the wished result.

But it's then performing a new search with the same search words/phrases.

In Boards you can just link an searchid,
which is more comfortabler.

but whatever the result is the same,
and i think it's not really neccessary for an gallery script to save searchs like in an forum.

Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Search feature?
« Reply #5 on: February 18, 2006, 09:02:45 PM »
In Boards you can just link an searchid,
which is more comfortabler.
Yes, I agree, the url is shorter and nicer, but the searchid will eventually expired...
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Vhaeos

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Search feature?
« Reply #6 on: February 20, 2006, 11:05:01 PM »
Alright, thanks. I just added almost all of the bug fixes. Except this one and this one. I didn't add the first one, as I couldn't find the first string he said to find, and I didn't install the second because I don't use ImageMagick or NetPBM. I've also just added the modifications you posted, and, it seems to be working fine. The only (small) problem, is that the search string doesn't seem to show up when a search is done from the header. But, only when it's done from the advanced search. This doesn't really matter all that much, but, I figured I'd mention it.

As for why I want this, I want to be able to link to a certain "set" of images, and have all of them show up. But, I don't want to create another catagory just for them.

Again, thanks, that is really helpful.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Search feature?
« Reply #7 on: February 21, 2006, 01:06:50 AM »
the search string doesn't seem to show up when a search is done from the header. But, only when it's done from the advanced search.
That means that form still using POST method, you'll need change the template where that form is (probably each "main" template)

As for why I want this, I want to be able to link to a certain "set" of images, and have all of them show up. But, I don't want to create another catagory just for them.
Alternatively, you could install "Multi-lightboxes" mod that allow share lightboxes with others. That way you could show images whith different keywords on one page ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)