VF DSL 468x60

Making the Section Menu work correctly with TemplaVoila

Submitting your vote...
Rating: 5.0 of 5. 2 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


No comments

Add comment

* - required field

*



*
*

Top 10 Updates

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
A introduction to the CONTENT object geändert am  26-Jan-2009 12:20:39
Sample for dynamic image masks geändert am  16-Dec-2008 15:42:32
Useful Links geändert am  11-Dec-2008 10:06:17
Using Transparent PNG's in IE5/6 without JavaScript geändert am  04-Oct-2008 12:27:15
Using lightbox without extension geändert am  13-Jun-2008 14:20:51

Latest comments

23-Feb-2010 04:40:25
Janna schrieb: what about the css? I am still not clear how to link typoscript with the css. Kindly...
Text menu
05-Feb-2010 18:38:50
Martin Terber schrieb: Didn't work for me neither. I will try in TMENU now.
Alternativ sorting for menu items
27-Jan-2010 23:41:31
romx schrieb: U know its dob't work apply to Tmenu))
Alternativ sorting for menu items
Deutsch
Search: