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