Page 1 of 1

linking back to search results

Posted: Thu Jan 15, 2009 8:56 pm
by blackhawk
with the search module, is there a way to create a link back to the search results page? instead of clicking on the back button of the browser window?

thanks

Re: linking back to search results

Posted: Fri Jan 16, 2009 1:48 am
by Zoorlat
You can always add your own back-button in your template

Code: Select all

<a href="javascript:history.go(-1)"> [Go Back]</a>
But then the link will show on the page regardless of whether a visitor came by searching or not.

In any case, don't underestimate your visitors, most surfers know how to use the back-button. It is always a good GUI design strategy to allow users to use what they are used to  :D

Re: linking back to search results

Posted: Fri Jan 16, 2009 4:26 am
by viebig
There is a elegant way to solve it

It´s possible to show the "back to results" link only when the user came from a search results page.

If you´re interested, let me know.

Regards

Re: linking back to search results

Posted: Tue Feb 03, 2009 2:34 pm
by lainyrache
Hi viebig,
I'm not the original poster but....
I would be very interested in your elegant solution for a 'back to search results' link.
Can you possibly let me know?
Many thanks,
Rachael

Re: linking back to search results

Posted: Tue Feb 03, 2009 3:07 pm
by viebig
Sure Rachel... let´s use one UDT

Name it backsolution

Code: Select all

$url = parse_url($_SERVER['HTTP_REFERER']);

$currenturl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

if($url['host'] == $params['site'] && $_SERVER['HTTP_REFERER'] != $currenturl)
{
return '<a href="'.$_SERVER['HTTP_REFERER'].'" title="Back Link">'.$params['text'].'</a> ';
}
Then use it like that on your pages

Code: Select all

{backsolution site='www.yourdomain.com' text="Go Back"}

The back button will only show if the last page accessed by the user was from your domain, and if was a direct hit , nothing will appear.

Let me know your thoughts

Re: linking back to search results

Posted: Tue Feb 03, 2009 3:39 pm
by lainyrache
Thanks for getting back to me so quickly!

Unfortunately, this isn't doing exactly what I was looking for. I have put the tag on my default template page and it shows on every page on my site. I would like it to only show on a search result page, to get back to the search results list page.

Any ideas how I could get it to do this???

Thanks again  ;D
Rachael

Re: linking back to search results

Posted: Tue Feb 03, 2009 3:57 pm
by viebig
That´s even more simple!

Sorry that I didnt get for the 1st time

update your tag

Code: Select all

if(strpos($_SERVER['HTTP_REFERER'],"mact=Search") !== false)
{
return '<a href="'.$_SERVER['HTTP_REFERER'].'" title="Back Link">'.$params['text'].'</a> ';
}
and now just use param text

Code: Select all

{backsolution text="Return to search results"}
And applaud me if it works!

Regards

Re: linking back to search results

Posted: Tue Feb 03, 2009 4:33 pm
by lainyrache
;D ;D ;D

Spot on - brilliant
Thanks viebig - that's great!
Thanks for taking the time to help with this...
Rachael