Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Customizing Search Title  (Read 3589 times)

0 Members and 1 Guest are viewing this topic.

flasyn

  • Contributor
  • Coppermine newbie
  • ***
  • Country: de
  • Offline Offline
  • Posts: 19
    • dokufoto.de
Customizing Search Title
« on: January 12, 2006, 01:02:41 pm »

Hi,

when I do a Search the pagetitle is "Search results", beneath that it displays the actual term I searched for :( Search results - "xyz").

Is there any way to put this search term in the pagetitle?

Your help would be much appreciated!
« Last Edit: January 24, 2006, 04:43:05 pm by Paver »
Logged

flasyn

  • Contributor
  • Coppermine newbie
  • ***
  • Country: de
  • Offline Offline
  • Posts: 19
    • dokufoto.de
Re: Customizing Search Title
« Reply #1 on: January 23, 2006, 06:25:54 pm »

Okay, at least I found where the Code is:

in thumbnails.php, line 165

Code: [Select]
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
-> This gives the Thumbnailpages its name.

in include/functions.inc.php, line 1241 is:

Code: [Select]
$album_name = $lang_meta_album_names['search'].' - "'. strtr($search_string, $HTML_SUBST) . '"';
which returns the term one searched for. Is there any way to add the searchterm to the pagetitle? Just adding
Code: [Select]
"'. strtr($search_string, $HTML_SUBST) . '"'; to the pageheader does not work...
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Customizing Search Title
« Reply #2 on: January 24, 2006, 12:15:34 am »

Here's one way to do it.  Look for this line in thumbnails.php (as you pointed out):
Code: [Select]
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);and replace it with these 3 lines:
Code: [Select]
$page_title = isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album];
$page_title .= $_POST['search'] ? ' - "'.$_POST['search'].'"' : '';
pageheader($page_title);

I split it into 3 lines to make it clear what you have added.
« Last Edit: January 24, 2006, 12:22:50 am by Paver »
Logged

flasyn

  • Contributor
  • Coppermine newbie
  • ***
  • Country: de
  • Offline Offline
  • Posts: 19
    • dokufoto.de
Re: Customizing Search Title
« Reply #3 on: January 24, 2006, 04:02:08 pm »

Thank you very much for replying and helping out!

Unfortunatly the posted code did not work (the search term did not show up).

 I fiddled a bit around:

Code: [Select]
$page_title = isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album];
$page_title .= $QUERY_STRING['search'] ? ' - "'.$QUERY_STRING['search'].'"' : '';
pageheader($page_title);

for example did work, returning me the whole searchstring (thumbnails.php?album=search&type=full&search=xxx) in the page title. But of course  no one wants the whole url, just the term.

But it seems to be the right  direction. Maybe you have another idea?
Logged

flasyn

  • Contributor
  • Coppermine newbie
  • ***
  • Country: de
  • Offline Offline
  • Posts: 19
    • dokufoto.de
Re: Customizing Search Title
« Reply #4 on: January 24, 2006, 04:13:53 pm »

 ;D

I just did it:
Code: [Select]
$page_title = isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album];
$page_title .= $_REQUEST['search'] ? ' - "'.$_REQUEST['search'].'"' : '';
pageheader($page_title);

does the trick.

Thank you very much indeed, Paver.

I wouldn't have been able to do it..
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Customizing Search Title
« Reply #5 on: January 24, 2006, 04:42:02 pm »

I'm not sure why $_POST didn't work for you.  Maybe it's a server issue.  Do you which webserver your site is on?  You can check the Coppermine DEBUG_INFO for this.

Good for you for figuring out how to get it to work for your site!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Customizing Search Title
« Reply #6 on: January 24, 2006, 11:32:41 pm »

If $_POST doesn't work, you probably have an ancient PHP version and should upgrade if the server is yours to administer. If it isn't suggest a PHP upgrade to your webhost.
Logged

flasyn

  • Contributor
  • Coppermine newbie
  • ***
  • Country: de
  • Offline Offline
  • Posts: 19
    • dokufoto.de
Re: Customizing Search Title
« Reply #7 on: January 25, 2006, 03:08:32 pm »

No, I got the most recent version (php5). I know it should work, but it just doesn't  ???
..anyways, I'm quite happy with the $_REQUEST  ;D

Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.