Member
Member
micheall   2010-12-28, 05:51
#1

Ok, so here is what I'm attempting to do.

I understand that I can create a manual search via url by using:
/index.php?p=search&words=whateveryouwanttosearchfor

I guess what I'm trying to do is get a bit of guidance if this is the best way to do this or not.

What I'm attempting to do is modify my 404.php so that it will automatically provide a link to search for the image or object that caused the error.

Basically I'm re-organizing my gallery and some of the links have been shared etc via social stuff, and are now no longer valid since the structure change to my content.

My hope is that I can set the search terms by using the 404 objects, and then either A) autorefresh to a search page, or B) provide a search link for the specified term.

I tried looking at the theme tutorial for search.php and it didn't provide a real hint as to how to go about it.

Member
Member
kagutsuchi   2010-12-28, 07:01
#2

I would probably use getSearchUrl() and echo the result. If all you want is the 'words' portion, then you can set dates and fields to be empty.

http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functiongetSearchURL

By the way, I would personally go with option B. I'm not a big fan of forced redirection, but that's just my personal preference.

Member
Member
micheall   2010-12-28, 07:51
#3

Thanks Kagutsuchi!

Works like a charm, here's it in action. I've moved my albums from root, to being subalbums under a Photography main album. One of the historied links:

http://inthemdl.net/randomstuff/fireballcake.jpg.php

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.