Author Topic: How do I display the searched keyword on search.php  (Read 8959 times)

0 Members and 1 Guest are viewing this topic.

Offline Art By Vicky

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • ABV Arts Enterprises
How do I display the searched keyword on search.php
« on: February 02, 2008, 07:48:49 AM »
I apologize if this has been discussed, however I've searched the forum and can't find this topic.  I would like to display the keyword that was used to perform the search on the search results page.  Example:  The keyword entered was "apple."  I would like the search results page to display "Search for apple" and then display the results.  Is this possible?  If so, can anyone explain how to do this?

Thanks to whomever can help with this.

ABVarts.com
RoundTableWebDesign.com
ArtByVicky.com
League of Animal Artists - AnimalArtists.org

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #1 on: February 02, 2008, 05:14:47 PM »
Yes, is possible. Is just for show in page ?
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Art By Vicky

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • ABV Arts Enterprises
Re: How do I display the searched keyword on search.php
« Reply #2 on: February 02, 2008, 09:40:07 PM »
Yes, I would like the keyword used to display to the right of the "Search" title at the top of the screen...  something like when a message appears.

I changed the following in the search template, thinking it would work:

Code: [Select]
<b class="title">{lang_search}</b><br />
to:
Code: [Select]
<b class="title">{lang_search}</b> for {search_keywords}<br />
But, it didn't work.  Do you have any ideas how I could get this to work?

Thanks for your help!
ABVarts.com
RoundTableWebDesign.com
ArtByVicky.com
League of Animal Artists - AnimalArtists.org

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #3 on: February 02, 2008, 11:21:32 PM »
Hum ... first time I try this so make backup of search.php file ...

// Step 1

In search.php file,

find:

Code: [Select]
if ($search_keywords != "" && $show_result == 1) {

add after:

Code: [Select]
$get_search_word_show = preg_replace("/" . $site_template->start . "search_word_show" . $site_template->end . "/siU", format_text(trim($search_keywords), 2), $lang['search_word_show']);

after - find:

Code: [Select]
"search_user" => format_text(stripslashes($org_search_user), 2),

add after:

Code: [Select]
"lang_search_word_show" => (isset($get_search_word_show) && !empty($get_search_word_show)) ? $get_search_word_show : "",

// Step 2

In lang/english/main.php file,

add in top ?>:

Code: [Select]
$lang['search_word_show'] = "You search for: <b>{search_word_show}</b>";

// Step 3

Use: {lang_search_word_show} in templates/your_template/search_form.html file .
« Last Edit: February 03, 2008, 12:47:18 AM by thunderstrike »
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Art By Vicky

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • ABV Arts Enterprises
Re: How do I display the searched keyword on search.php
« Reply #4 on: February 03, 2008, 12:06:24 AM »
Oh darn!  I really thought this was going to work.  But unfortunately, it still didn't work.  Nothing displays. :cry: :cry:

Thank you so much Thunderstrike for giving this such a good try.  I really did think that one was going to work.

Thanks!
ABVarts.com
RoundTableWebDesign.com
ArtByVicky.com
League of Animal Artists - AnimalArtists.org

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #5 on: February 03, 2008, 12:19:31 AM »
I edit post. Restore backup and try again.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Art By Vicky

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • ABV Arts Enterprises
Re: How do I display the searched keyword on search.php
« Reply #6 on: February 03, 2008, 12:37:05 AM »
I'm sorry Thunderstrike.  It still isn't working.  Don't worry about it.  This isn't that big a deal.  Please don't waste your time on this.  I can live without this tweak.

Thank you so much for all your help with my questions/requests.  It's much appreciated.

Thanks!
ABVarts.com
RoundTableWebDesign.com
ArtByVicky.com
League of Animal Artists - AnimalArtists.org

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #7 on: February 03, 2008, 12:37:46 AM »
Quote
I'm sorry Thunderstrike.  It still isn't working.

Sorry, I no can reproduce this. Is show purfect in my site (after I edit post).
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #8 on: February 03, 2008, 12:47:36 AM »
I fix step 3, is filename problem. ;)
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?

Offline Art By Vicky

  • Jr. Member
  • **
  • Posts: 59
    • View Profile
    • ABV Arts Enterprises
Re: How do I display the searched keyword on search.php
« Reply #9 on: February 03, 2008, 02:40:56 AM »
Okay, we're getting closer!  If I search for a keyword that is not in the db and it goes to the search form page to tell me there were no matches found, the text does appear.  However, if images are found matching the keyword, the text does not appear on the search results page.  I want it to appear in both instances.  Is there another place in the search.php file where I should put something so it displays when images are found?

Good job so far, but we're not quite there yet!

Thanks for continuing to work on this for me!

Oh, and btw, I never added the {lang_search_word_show} to the search_form.html.  I left it on the search.html file from your original instructions.  It does work when on the search.html file as long as no images are found.  I was searching for images that I knew where in the db, so the keywords never appeared when I tested it.
ABVarts.com
RoundTableWebDesign.com
ArtByVicky.com
League of Animal Artists - AnimalArtists.org

Offline thunderstrike

  • 4images Guru
  • *******
  • Posts: 2.327
    • View Profile
Re: How do I display the searched keyword on search.php
« Reply #10 on: February 03, 2008, 03:18:42 AM »
Quote
I want it to appear in both instances

Why you no say this first for use {msg} ? Is more edit for no use. :?

replace this:

Code: [Select]
$get_search_word_show

for:

Code: [Select]
$msg

and remove {lang_search_word_show} in template.

Please - next time - post full request.
8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?