coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: flasyn on January 12, 2006, 01:02:41 PM

Title: Customizing Search Title
Post by: flasyn 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!
Title: Re: Customizing Search Title
Post by: flasyn on January 23, 2006, 06:25:54 PM
Okay, at least I found where the Code is:

in thumbnails.php, line 165

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:

$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 "'. strtr($search_string, $HTML_SUBST) . '"'; to the pageheader does not work...
Title: Re: Customizing Search Title
Post by: Paver 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):
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
and replace it with these 3 lines:
$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.
Title: Re: Customizing Search Title
Post by: flasyn 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:

$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?
Title: Re: Customizing Search Title
Post by: flasyn on January 24, 2006, 04:13:53 PM
 ;D

I just did it:

$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..
Title: Re: Customizing Search Title
Post by: Paver 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!
Title: Re: Customizing Search Title
Post by: Joachim Müller 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.
Title: Re: Customizing Search Title
Post by: flasyn 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