[TYPO3] problem with wfqbe (ext) and preProcessQueryStructure (hook)
Martin
ber.lin.ux at gmx.de
Sat Feb 2 14:04:47 CET 2008
Hi Mauro, thank's for your reply. However, I get an error message: Fatal
error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 35 bytes) in
/server/[...]/res/class.tx_wfqbe_preprocessquery.php on line 19 The
memory limits are OK. Infinite loop? I'm sorry, but there's something
else to change in this while-loop? Thank you very much, Martin Hi
Martin, [...]
> > The query structure looks like this:
> >
> > SELECT * FROM dbliterature WHERE ( dbliterature.author LIKE
> > '%###WFQBE_AUTHOR###%' OR dbliterature.institution LIKE
> > '%###WFQBE_AUTHOR###%' ) AND ( dbliterature.title LIKE
> > '%###WFQBE_TITLE###%' OR dbliterature.journal_title LIKE
> > '%###WFQBE_TITLE###%' ) AND ( dbliterature.descriptor LIKE
> > '%###WFQBE_DESCRIPTOR###%' OR dbliterature.abstract LIKE
> > '%###WFQBE_DESCRIPTOR###%' )
> >
> > I then created a search form page with the wfqbe-extension which
> > provides several input areas each connected to the according markers for
> > author, title, descriptors, etc. Leaving one of these input areas blank
> > (e.g. searching by an author's name only, not giving a search input for
> > "title") the extension should disregard the unused markers and generate
> > a MYSQL search query based on used inputs only.
> >
> > Example:
> >
> > author: Smith
> > title: nations
> > descriptor: BLANK
> >
> > I used the hook mentioned in the extension's documentation
> > (preProcessQueryStructure) and configured it as described in a list post
> > (http://www.typo3board.com/ftopic12181.html), as follows:
> >
> > class tx_wfqbe_preprocessquery {
> > function tx_wfqbe_preprocessquery() {
> > } function process_query_structure($wfqbe, $piVars,
> > $query_uid,
> > &$callingObj) {
> > $remove = array();
> > // Query to be processed
> > if ($query_uid==13) { $markers = array(
> > "AUTHOR", "TITLE", "DESCRIPTOR"
> > );
> > foreach ($markers as $marcatore) {
> > if ($piVars[$marcatore]=='' ||
> > (is_array($piVars[$marcatore]) && $piVars[$marcatore][0]=='')) {
> > foreach ($wfqbe[0]['insert'] as $key => $value) {
> > if (strpos($value, 'WFQBE_'.$marcatore)>0) {
> > $remove[] = $key;
> > unset($wfqbe[0]['insert'][$key]);
> > }
> > }
> > }
> > }
> > }
> > return $remove;
> > }
> > }
>
[...]
the problem is that you used the same marker more than one time. This is
not a problem but you need to modify the hook code to remove all the
unused markers.
try to modify the following line of code:
if (strpos($value, 'WFQBE_'.$marcatore)>0) {
with this new code:
while (strpos($value, 'WFQBE_'.$marcatore)>0) {
I didn't test it but it should remove all the unused markers.
Best regards,
-- Mauro Lorenzutti
More information about the TYPO3-english
mailing list