1
votes

I am building a website with TYPO3 6.0.2 and fluid. I have a partial that is basically a menu of four buttons leading to four different pages. It is not the main menu, neither is it a sublevel menu.

So far I build that menu myself by using . However, the link text would either be only in one language, or I would have to use language files and in order to get the text in the appropriate language.

But as the system is able to retrieve the title in the current language in other situations (e.g. when building menus), I wondered if there is not fluid or fed/vhs helper that gives me the title/alternative title of a page with a certain id.

Alternatively, what I am building is basically another menu with items from different levels within the page tree. Thus I am wondering if this could be done either with a helper or with TypoScript.

Would this be a good practice: create a folder in the page tree, and within than folder create a page for each of my alternative menu's items, and make each page a shortcut to the actual page I want to link to? Then use the vhs's menu view helper and set the folder's id as the pageUid.

3
Was the answer helpfull? Could you give a response?András Ottó

3 Answers

3
votes

This is a simple TS snippet:

lib.page-link = TEXT
lib.page-link.value.data = DB:tt_content:{current:1}:header
lib.page-link.value.insertData = 1
lib.page-link.typolink.parameter.data = current

that can be referenced from fluid like this:

<f:cObject typoscriptObjectPath="lib.page-link">19</f:cObject>

Outputs sth like this (from the page with uid 19):

<a href="en/downloads.html">Downloads</a>
2
votes

Another option - easier, but has a dependency extension (one that provides a large collection of highly useful ViewHelpers which you -will- become addicted to having around):

https://fluidtypo3.org/viewhelpers/vhs/master/Page/InfoViewHelper.html

It lets you fetch one field from a page which you identify by UID. There are other ViewHelpers which for example lets you render menus and content elements - which is almost always simpler, shorter and more flexible (at least, without a HUGE script) than using TypoScript too make complex objects.

The "VHS" extension (key: vhs) is a must-have companion for any developer creating fluid templates - and I don't just say that because I wrote it ;)

Cheers,
Claus aka. NamelessCoder

PS: on the same site you will find many other extensions which can let you be more consistent and at the same time faster when working on any type of fluid template. It's definitely worth a look.

1
votes

I just faced with a similiar issue, but maybe it is helpfull to you too:

1. Step, put this into your Fluid template:

<f:cObject typoscriptObjectPath="lib.menuwithbuttons" />

2. Step, in your TypoScript you can define your own menu:

lib.menuwithbuttons = HMENU
lib.menuwithbuttons {
      special = list
      #your pageIDs
      special.value = 1,2,3,4 
}

To use the button style what you have, you can use the linkWrap property in your TS.