Customizing Search Title Customizing Search Title
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Customizing Search Title

Started by flasyn, January 12, 2006, 01:02:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

flasyn

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!

flasyn

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...

Paver

#2
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.

flasyn

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?

flasyn

 ;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..

Paver

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!

Joachim Müller

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.

flasyn

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