Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [pugdog] Improved Search Logger

Quote Reply
Re: [pugdog] Improved Search Logger In reply to
Ok,

Looking at the issue, Search.pm does not return nh= anything to the templates. It only returns 'next' which is already pre-parsed.

I've tried to figure out a template only type solution, but can't, since Search::query can be called from multiple places, not only the search.html

It *might* be possible to use a pre-hook on Search::query , and see if 'nh' is defined, and if it is, is it <2.

If it is, then set $IN->param('Log_Me') to '1'. You'd have to push onto this hash, since you need it carried through to the post_hook where the logging takes place.

Then, in the SearchLogger.pm file before you log anything, check to see

return if ($IN->param('Log_Me) == 1);



===



I'm still half asleep with a pounding stress headache, and my male Pekingese is doing a mating dance with my femal Sheltie (or trying to) on the hardwood floor so all I hear is a tap-tap-tap of toe-nails and a lot of grunting and wheezing (I know you wanted to know that....) ..... but the point is, if this looks like it will work, I'll try to update the plugin this way.

If someone has a better idea, I will check it out.

But the problem is, and if you look at <%GT::Template::dump%> there is no "flag" field like nh being passed into the templates any more, so without editing Search.pm (which would be non portable) you need to come up with a solution that will work _anywhere_ search is called.


...


Hmmm..... Now that I'm thinking about it... Search::query can be called from anywhere, the first time, but _only_ can be sent page 2, 3, etc from the search_results.html.

What about _reverse_ logic. Set a flag in the search_results.html template, (which _would_ be passed through all phases of the system, in the $IN hash), such that "Log_Me_Not=1".

<input type=hidden name=Log_Me_Not value=1>

Then in SearchLogger.pm's logging routine, add in,

my $log_me_not = defined $IN->param('Log_Me_Not') ? 1 : 0; ## prevents undefined errors/warnings
return && ($log_me_not == 1);

above the logging code.

====

Two choices. Try the second one first... it may actually work <G> (and if it doesn't, it's only two lines of code to remove or debug).

Just a programming note: When you set a flag, that you are going to test for, you really want to set it to some value, not '0'. So, using "Log_Me=0" is *not* a good way to do it. In this case, since we want to skip the log phase if we are not on page 1, we need to use a double negative logic "if not on page1, Log_Me_Not=1" so you have a parameter with a "set" value that will be passed, and not dropped along the way. "Log_Me_Not=0" will be true (undefined) on any page that isn't specifically set "Log_Me_Not=1" so anywhere else that search is called, the logging will occur.

.... Good Luck .... :)


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Subject Author Views Date
Thread Improved Search Logger pugdog 8529 Dec 29, 2001, 10:17 PM
Thread Re: [pugdog] Improved Search Logger
Alex 8320 Dec 30, 2001, 9:21 AM
Thread Re: [Alex] Improved Search Logger
pugdog 8354 Dec 30, 2001, 11:03 AM
Post Re: [pugdog] Improved Search Logger
Ian 8172 Apr 20, 2002, 11:43 PM
Post Re: [pugdog] Improved Search Logger
Ian 8075 Apr 21, 2002, 7:42 PM
Post Re: [pugdog] Improved Search Logger
Canoon 8267 Feb 11, 2002, 2:17 PM
Thread Re: [pugdog] Improved Search Logger
SeanP 8156 Apr 21, 2002, 1:32 PM
Thread Re: [SeanP] Improved Search Logger
pugdog 8194 Apr 21, 2002, 7:44 PM
Post Re: [pugdog] Improved Search Logger
Ian 8030 May 6, 2002, 11:53 AM
Thread Re: [pugdog] Improved Search Logger
SeanP 7962 Jun 5, 2002, 7:36 PM
Thread Re: [SeanP] Improved Search Logger
pugdog 7996 Jun 8, 2002, 6:31 AM
Thread Re: [pugdog] Improved Search Logger
pugdog 8003 Jun 8, 2002, 7:19 AM
Post Re: [pugdog] Improved Search Logger
SeanP 7989 Jun 8, 2002, 10:45 AM
Thread Re: [pugdog] Improved Search Logger
craven32 7663 Nov 8, 2003, 9:54 PM
Thread Re: [craven32] Improved Search Logger
afinlr 7570 Nov 9, 2003, 5:46 AM
Thread Re: [afinlr] Improved Search Logger
craven32 7608 Nov 9, 2003, 7:42 AM
Post Re: [craven32] Improved Search Logger
afinlr 7588 Nov 9, 2003, 7:52 AM
Thread Re: [craven32] Improved Search Logger
pugdog 7546 Nov 13, 2003, 12:25 PM
Post Re: [pugdog] Improved Search Logger
pugdog 7493 Dec 1, 2003, 10:54 AM