theowi
theowi

Reputation: 820

Build HMENU with Information from TCE

I have extended the TCA for every Backend-Page on the Page-Tree. One of the new Options is the "Page-Type", for example "PressPage". With this Extension, i have a new databasefield in the table "pages".

Now i would build an HMENU/TMENU with all pages, below this folder.

[...]
lib.MetaPressNavigation{
    special = directory
    special.value = ID_FROM_FOLDER_WITH_PAGETYPE_PRESSPAGE
    [...]

But i have no idea to realize them with typoscript. I hope anyone can help me.

Thanks.

EDIT:

Now - i have try it with an extended TCA. It's very easy for any User to make some configuration for this projectpage. The Users can set a value with an Checkbox in a special tab.

I have try to get the page out form the database, with this special config - any page have in the database on the column "tx_meta_pagetype the value 9. I need the UID from this page to build the META-Navigation. It will be full functional - when i give a hardcoded uid, but i need this dynamic.

This is my attemp, to get the UID from the database:

temp.MetaNavigationIds = CONTENT
temp.MetaNavigationIds{
    table = pages
    select.Where = tx_meta_pagetype = 9 #tx_meta_pagetype is set from the TCA
    renderObj = TEXT
    renderObj.field = uid
    renderObj.stdWrap = |
}

lib.MetaNavigation = HMENU
lib.MetaNavigation{
    special = directory
    special.value < temp.MetaNavigationIds #the UID of configured page, that i need for the menu

    1 = TMENU
    1 {
        wrap = <ul> | </ul>
        NO{
            wrapItemAndSub = <li> | </i>
            wrapItemAndSub.insertData = 1
            allStdWrap.insertData = 1
        }
    }
}

I have try a lot of database question with typoscript, but nothing works.

Upvotes: 0

Views: 425

Answers (2)

pgampe
pgampe

Reputation: 4578

Be careful, special.value is not a content object but just a property. You are copying a content object (CONTENT) in its place. This does not work.

However it does have stdWrap. Therefore something like

special.value.stdWrap.cObject < temp.MetaNavigationIds

Should work out.

For renderObj.stdWrap = | enter renderObj.wrap = |, instead. Please mind the trailing comma. This will make sure that you actually get a comma separated list of uids. Otherwise your uids would be printed just after each other, thus forming one big number.

Please test each part individually before adding the components together. You should make sure that each pease returns the correct data, otherwise you will never get a working solution.

And of course select.Where must be select.where. Capitalization does matter.

Here is a working example for CONTENT:

page.10 = CONTENT
page.10 {
  table = pages
  select {
    where = doktype = 199
    recursive = 99
    # Needs to be your root page uid
    pidInList = 1
  }
  renderObj = TEXT
  renderObj.field = uid
  renderObj.wrap = |,
}

Upvotes: 1

derhansen
derhansen

Reputation: 6133

If you are using TYPO3 6.2, I would recommend to use the new category system. You can create different categories in the TYPO3 backend and assign those categories to your pages.

With this, you can create a HMENU/TMENU like shown below:

20 = HMENU
20 {
    special = categories
    special.value = 1,2
    1 = TMENU
    1.NO {
            ...
    }
}

If you do not use TYPO3 6.2 or do not want to use the category system, you can use a userfunction to return the pages which matches your "Page-Type".

HMENU/TMENU TypoScript will be like shown below.

lib.leftmenu.20 = HMENU
lib.leftmenu.20.special = userfunction
lib.leftmenu.20.special.userFunc = user_myspecialmenu_pi1->getPressPages

The TypoScript above is just an example, and you need to code the userfunction your own.

A detailed reference of the special property userfunction is available here and a example can be found here.

Upvotes: 0

Related Questions