TYPO3Jack.net - Das TYPO3 Mailinglist Forum Archiv

Die TYPO3 Mailingliste - nicht fragen: lesen!

[TYPO3] userFunc in HMENU not working if the results array is toobig (with templavoila)

This is a discussion on [TYPO3] userFunc in HMENU not working if the results array is toobig (with templavoila) within the typo3-english@lists.netfielders.de forums, part of the TYPO3-Mailinglists: ENGLISH category; It seems that HMENU has a bug when using a userFunc that returns a too big array. If the number ...


Zurück   TYPO3Jack.net - Das TYPO3 Mailinglist Forum Archiv > TYPO3-Mailinglists: ENGLISH > typo3-english@lists.netfielders.de

Registrieren Hilfe Benutzerliste Kalender Suchen Heutige Beiträge Alle Foren als gelesen markieren
  #1  
Alt 27.06.2008, 10:44
Olivier Schopfer
Gast
 
Beiträge: n/a
Standard [TYPO3] userFunc in HMENU not working if the results array is toobig (with templavoila)

It seems that HMENU has a bug when using a userFunc that returns a too
big array. If the number of results is limited, then it works perfectly.
If I have around 350 items, it fails and I get a blank page. Strange
enough, it doesn't raise an error condition. Moreover, the admin pannel
is still displayed, and seems to show the proper content of the menu.

Any idea?

Olivier

I have the following typoscript code in a TemplaVoilà data structure for
a page:

20 = HMENU
20.special = userfunction
20.special.userFunc =
tx_osprayercyclemenus_pi1->generateFilteredMenuFromList
20.special.userFunc.field = member_of
20.special.userFunc.datastructure = 44
20.special.userFunc.select.selectFields =
uid,title,nav_title,tx_templavoila_flex
20.1 = TMENU
20.1 {
NO {
doNotLinkIt = 0
stdWrap.field = title
# Remove the # from the next line if you want to see which fields are
available!
#stdWrap.data = debug:data
#typolink.parameter.field = www
ATagTitle.field = nav_title // title
allWrap = <div class="hb_link">|</div>
}
}

And the code of the userFunc is:

/* This function generates a menu out of a subset of pages for which a
certain templavoila Field list contains a certain value */

function generateFilteredMenuFromList($content,$conf) {
/**
*
* field = field that contains the list (nested)
* datastructure = templavoila datastructure (list, comma separated)
* select.selectFields = list of selected fields do you want.
*
*/
$local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local cObj.
$menuArr = array();
$subArr = array();
$lConf = $conf["userFunc."];
$value = $local_cObj->stdWrap($lConf["value"],$lConf["value."]);
$res =
$GLOBALS['TYPO3_DB']->exec_SELECTquery($lConf["select."]["selectFields"],'pages','
tx_templavoila_ds IN ( '.$lConf["datastructure"].') ORDER BY title ASC ');
//t3lib_div::debug($lConf);
//t3lib_div::debug($lConf["value."]["data"]);

if ($error = $GLOBALS['TYPO3_DB']->sql_error()) {
$GLOBALS['TT']->setTSlogMessage($error,3);
} else {
$GLOBALS['TT']->setTSlogMessage('NUMROWS:
'.$GLOBALS['TYPO3_DB']->sql_num_rows($res));
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$XML = t3lib_div::xml2array($row['tx_templavoila_flex']);

if (is_array($XML)) {
$subArr =
$XML['data']['sDEF']['lDEF'][$lConf['field']];

if (is_array($subArr['el'])) {
foreach ($subArr['el'] as $val) {
$fieldValue =
$val['list_member_of']['el']['field_link']['vDEF'];
if
($fieldValue==$GLOBALS["TSFE"]->id) {
unset($row['tx_templavoila_flex']);
$menuArr[] = $row;
}
}
}
}
}
}
return $menuArr;
}
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #2  
Alt 27.06.2008, 11:21
Dmitry Dulepov [typo3]
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Hi!

Olivier Schopfer wrote:
> It seems that HMENU has a bug when using a userFunc that returns a too
> big array. If the number of results is limited, then it works perfectly.
> If I have around 350 items, it fails and I get a blank page. Strange
> enough, it doesn't raise an error condition. Moreover, the admin pannel
> is still displayed, and seems to show the proper content of the menu.
>
> Any idea?


Do you have PHP error reporting enabled in Install tool?

> I have the following typoscript code in a TemplaVoilà data structure for
> a page:


<skip>

> allWrap = <div class="hb_link">|</div>


I assume you wrapped script with CDATA? Other it will produce invalid DS XML.

> And the code of the userFunc is:


<skip>

> $local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local cObj.
> $menuArr = array();
> $subArr = array();
> $lConf = $conf["userFunc."];
> $value = $local_cObj->stdWrap($lConf["value"],$lConf["value."]);


Please, be consistent, use only single quotes This save several milliseconds for each request.

> $res =
> $GLOBALS['TYPO3_DB']->exec_SELECTquery($lConf["select."]["selectFields"],'pages','
> tx_templavoila_ds IN ( '.$lConf["datastructure"].') ORDER BY title ASC ');


<skip>

> return $menuArr;


Resource leak: recordset is not freed. You'll get lots of memory leaks in Apache/MySQL if you use persistent MySQL connections.

--
Dmitry Dulepov
http://typo3bloke.net/
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #3  
Alt 27.06.2008, 14:49
Olivier Schopfer
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Dmitry Dulepov [typo3] wrote:
> Hi!
>
> Olivier Schopfer wrote:
>> It seems that HMENU has a bug when using a userFunc that returns a too
>> big array. If the number of results is limited, then it works
>> perfectly. If I have around 350 items, it fails and I get a blank
>> page. Strange enough, it doesn't raise an error condition. Moreover,
>> the admin pannel is still displayed, and seems to show the proper
>> content of the menu.
>>
>> Any idea?

>
> Do you have PHP error reporting enabled in Install tool?

Sure I do. PHP warnings and errors are logged in error.log. In this
case, no error is logged.
>
>> I have the following typoscript code in a TemplaVoilà data structure
>> for a page:

>
> <skip>
>
>> allWrap = <div class="hb_link">|</div>

>
> I assume you wrapped script with CDATA? Other it will produce invalid DS
> XML.

Yes it is embedded within a CDATA.
>
>> And the code of the userFunc is:

>
> <skip>
>
>> $local_cObj = t3lib_div::makeInstance('tslib_cObj'); // Local cObj.
>> $menuArr = array();
>> $subArr = array();
>> $lConf = $conf["userFunc."];
>> $value = $local_cObj->stdWrap($lConf["value"],$lConf["value."]);

>
> Please, be consistent, use only single quotes This save several
> milliseconds for each request.

Thanks for the suggestion. I replaced the quotes.
>
>> $res =
>> $GLOBALS['TYPO3_DB']->exec_SELECTquery($lConf["select."]["selectFields"],'pages','
>> tx_templavoila_ds IN ( '.$lConf["datastructure"].') ORDER BY title ASC
>> ');

>
> <skip>
>
>> return $menuArr;

>
> Resource leak: recordset is not freed. You'll get lots of memory leaks
> in Apache/MySQL if you use persistent MySQL connections.


You are right, that was missing. I added
GLOBALS['TYPO3_DB']->sql_free_result($res);
But it still doesn't work. Up to 340 records is ok, but not more.

Could it be an error in TemplaVoila? The Admin Panel shows a correct
array for the HMENU, but no page is rendered.

_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #4  
Alt 27.06.2008, 14:57
Dmitry Dulepov [typo3]
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Hi!

Olivier Schopfer wrote:
> Could it be an error in TemplaVoila? The Admin Panel shows a correct
> array for the HMENU, but no page is rendered.


TemplaVoila does not process TypoScript or menu. It only walks each field on the page and asks TYPO3 to create content for it.

--
Dmitry Dulepov
http://typo3bloke.net/
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #5  
Alt 27.06.2008, 15:25
Olivier Schopfer
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Dmitry Dulepov [typo3] wrote:
> Hi!
>
> Olivier Schopfer wrote:
>> Could it be an error in TemplaVoila? The Admin Panel shows a correct
>> array for the HMENU, but no page is rendered.

>
> TemplaVoila does not process TypoScript or menu. It only walks each
> field on the page and asks TYPO3 to create content for it.
>


So where would you look? Could it then be a bug in class.tslib_menu.php?
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #6  
Alt 27.06.2008, 16:03
Dmitry Dulepov [typo3]
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Olivier Schopfer wrote:
> So where would you look? Could it then be a bug in class.tslib_menu.php?


I have a debugger. So usually I just put a breakpoint somewhere and debug. I think tslib_menu, yes.

--
Dmitry Dulepov
http://typo3bloke.net/
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #7  
Alt 27.06.2008, 16:33
Olivier Schopfer
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Dmitry Dulepov [typo3] wrote:
> Olivier Schopfer wrote:
>> So where would you look? Could it then be a bug in class.tslib_menu.php?

>
> I have a debugger. So usually I just put a breakpoint somewhere and
> debug. I think tslib_menu, yes.
>


Can't do that, I'm working on a production server, with no debugging
tool installed. By the way, what debugger do you use? Does it work on
W**dows?
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
  #8  
Alt 03.09.2008, 11:21
Olivier Schopfer
Gast
 
Beiträge: n/a
Standard Re: [TYPO3] userFunc in HMENU not working if the results array istoo big (with templavoila)

Olivier Schopfer wrote:
> Dmitry Dulepov [typo3] wrote:
>> Olivier Schopfer wrote:
>>> So where would you look? Could it then be a bug in class.tslib_menu.php?

>>
>> I have a debugger. So usually I just put a breakpoint somewhere and
>> debug. I think tslib_menu, yes.
>>

>
> Can't do that, I'm working on a production server, with no debugging
> tool installed. By the way, what debugger do you use? Does it work on
> W**dows?


I finally found the explanation. It's a bug in the core. The
prefixLocalAnchor post processing is crashing whenever there are too
many links.

See http://bugs.typo3.org/view.php?id=6415

A working patch is available there.

Olivier
_______________________________________________
TYPO3-english mailing list
TYPO3-english (AT) lists (DOT) netfielders.de
http://lists.netfielders.de/cgi-bin/.../typo3-english
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Wong this Post!Spurl this Post!Reddit! Diesen Post bei linksilo.de bookmarken!
 

Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an


Ähnliche Themen

Thema Autor Forum Antworten Letzter Beitrag
[TYPO3] How to put CATMENU to HMENU in templavoila? Matyi Gábor typo3-english@lists.netfielders.de 1 06.03.2008 09:08
[TYPO3] Working example of userFunc Patrick Schlaepfer typo3-english@lists.netfielders.de 2 02.01.2008 00:56
[TYPO3] typoscript HMENU/TMENU create js image array (all pages) Gijs Epping typo3-english@lists.netfielders.de 0 22.10.2007 09:34
[TYPO3-german] TemplaVoila und HMENU/GMENU Schani typo3-german@lists.netfielders.de 1 18.08.2007 17:14
[TYPO3-templavoila] Indexed Search Results not showing with TV Ron Hall typo3-project-templavoila@lists.netfielders.de 2 24.05.2007 18:29


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:15 Uhr.


Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39