Making the Section Menu work correctly with TemplaVoila

Submitting your vote...
Rating: 3.7 of 5. 3 vote(s).
Click the rating bar to rate this item.

If you are using TemplaVoila, you might have noticed that the Menu/Sitemap type "Section index (pagecontent w/Index checked)", doesn't work correctly anymore. (Deleted elements show up on the menu and the sorting order is wrong.)

Section Menu Templavoila

This is because TemplaVoila rendering doesn't rely on the sorting or the deleted fields, but instead stores a list of uids for the visible content elements in an extra pages field (tx_templavoila_flex).

With a little bit of TypoScript magic, we can solve that problem.

By storing the list of visible uids in a register value (recordsInTVField ), we can reuse the uidlist for making a TypoScript SQL lookup, returning only the visible CEs, and in the correct sorting order.

The register value could also be used in other scripts, where you need to know the list of CE uids.

The "Fix"

In your TemplaVoila Data Structure (DS), locate all the fields which are set to hold Content Elements (CE)

It usually looks like this:

 

10 = RECORDS
10.source.current=1
10.tables = tt_content
10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->

 

Change it to the following:

 

5 = LOAD_REGISTER
5.recordsInTVField.data = current:1
10 = RECORDS
10.source.data=register:recordsInTVField
10.tables = tt_content
10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
15 = RESTORE_REGISTER

 

Then in your TypoScript SETUP field, enter this:

 

tt_content.menu.20.3 >
tt_content.menu.20.3 = CONTENT
tt_content.menu.20.3 {
  wrap = <ul class="csc-menu csc-menu-3">|</ul>
  table = tt_content
  select.pidInList = this
  select.andWhere.dataWrap = uid IN ({register:recordsInTVField}) AND sectionIndex!=0
  renderObj = TEXT
  renderObj {
    fieldRequired = header
    trim=1
    field = header
    htmlSpecialChars = 1
    wrap = <li class="csc-section">|</li>
    typolink.parameter.field = pid
    typolink.section.field = uid
  }
}

 

NOTE: You should do this for every column in your Page DS, or you might end up with uid values

from the other columns.

 

This Snippet was submitted by Peter Klein



Comments


Gary, 26-07-10 19:46:
Great snippet! But I could no get the CONTENT object to return the content elements in the correct order. I think because MySQL always use the PRIMARY index and returns them in order.

I changed it to RECORDS and it works (found here http://bugs.typo3.org/bug_view_advanced_page.php?bug_id=465):

tt_content.menu.20.3 >
tt_content.menu.20 {
3 = RECORDS
3.wrap = <ul class="csc-menu csc-menu-3">|</ul>
3.source.data = register:recordsInTVField
3.tables = tt_content
3.conf.tt_content = TEXT
3.conf.tt_content {
if.isTrue.field = sectionIndex
noBlur = 1 #XXX added
fieldRequired = header
trim=1
field = header
htmlSpecialChars = 1
wrap = <li class="csc-section">|</li>
typolink.parameter.field = pid
typolink.section.field = uid
}&#8203;

Add comment

* - required field

*



*
*

Top 10 Updates

Nice fonts using Google font API geändert am  20-May-2010 16:36:47
TS-based Searchbox for Indexed Search  geändert am  18-May-2010 18:27:15
TYPO3 SEO geändert am  30-Apr-2010 09:44:22
Search engine friendly graphical headers in TYPO3 geändert am  30-Apr-2010 09:33:44
Creating a simple Infocenter using TYPO3 geändert am  17-Nov-2009 12:12:52
Making the Section Menu work correctly with TemplaVoila geändert am  05-May-2009 12:27:17
Show pages with type "Not in Menu" in a sitemap geändert am  05-May-2009 12:11:17
Implementation of the DHTML menu from brainjar.com  geändert am  01-Feb-2009 14:02:48
Sample DHTML menu geändert am  01-Feb-2009 13:51:25
A introduction to the CONTENT object geändert am  26-Jan-2009 13:20:39

Latest comments

21-Jan-2012 20:22:24
jemmkwc jemmkwc schrieb: MOGWOX , [url=http://prdpuhwzxyrc.com/]prdpuhwzxyrc[/url],...
fe_useradmin form does not save
20-Jan-2012 20:35:32
fsivjktiuld fsivjktiuld schrieb: idCmnv <a href="http://gakbrrkrxhye.com/">gakbrrkrxhye</a>
fe_useradmin form does not save
19-Jan-2012 18:05:25
bvffee bvffee schrieb: jl2vQt , [url=http://xcinvpbclrbm.com/]xcinvpbclrbm[/url],...
External links and shortcuts directly in the menu
Deutsch
Search: