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 17: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

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

Latest comments

17-Jun-2013 19:46:54
sxwluus sxwluus schrieb: 5UymqQ , [url=http://xgbwceyjiybq.com/]xgbwceyjiybq[/url],...
tt_news frontend editing
17-Jun-2013 11:47:10
csfhvekmk csfhvekmk schrieb: NsWb99 <a href="http://qwcpinxbhbrf.com/">qwcpinxbhbrf</a>
tt_news frontend editing
15-Jun-2013 12:26:34
msosqw msosqw schrieb: Env97k , [url=http://ejofmzvtlxyx.com/]ejofmzvtlxyx[/url],...
pidInRootLine,treeLevel,TSFE:id
Deutsch
Search: