Die TYPO3 Mailingliste - nicht fragen: lesen!
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 ...
|
|||||||
| Registrieren | Hilfe | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
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 |
| Themen-Optionen | Thema durchsuchen |
| Ansicht | Thema bewerten |
|
|
|
||||
| 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 |