Build HMENU with Information from TCE - typo3

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.

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 = |,
}

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.

Related

Get tx_news fal_media via TypoScript to use in fluid page template

I want to use the first image out of a new entry to include in the page header.
Therefore i need the news fal_media data in TypoScript to pass it to my page fluid template.
I managed to get the first image as a file path by this TypoScript code:
lib.newsimage = FILES
lib.newsimage {
references {
table = tx_news_domain_model_news
uid.data = GP:tx_news_pi1|news
fieldName = fal_media
}
maxItems = 1
renderObj = IMG_RESOURCE
renderObj.file {
import.data = file:current:publicUrl
}
stdWrap.ifEmpty = {$settings.ext.news.imageDummy}
}
But is there a better way to do it, especially to get the data as an array of FileReferences? With a FAL FileReference i could also take crop an meta data into account.
You might use a FilesProcessor
example based on the manual:
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10 {
as = news_images
references {
fieldName = fal_media
table = tx_news_domain_model_news
}
sorting = datetime
sorting.direction = descending
}
Although I can't imagine that this will be the correct way as there is no guarantee that the first news you select by this is the first news shown on the page. News have multiple conditions to be shown aside of basic visibility: ordering by publishing time, archived state, top-news state, groups or categories, ...
Maybe it would be easier if you use a news plugin with a special template and don't forget to enable showing of news multiple times (by default each news gets shown only once in a page)

Obtain the title of tt_news record for breadcrumb

the following code worked well until TYPO3 7.6 LTS. It checked for the title of the current tt_news record and wrote it to lib.breadcrumb.
Up from TYPO3 version 8.x the code obtains the titles of ALL existing tt_news records.
So I tried to modify the code in order get only the title of the CURRENT news item.
Using a static number (uidInList = 2) works fine: it gets the title of tt_news record with UID=2.
However I want dynamically obtain the title of the current news record identified by its ID.
Between select and andWhere I have inserted/commented several possibilities. None of them works out.
Any suggestions? THANKS!
[globalVar = GP:tx_ttnews|tt_news > 0]
lib.breadcrumb.20 = CONTENT
lib.breadcrumb.20 {
table = tt_news
select {
pidInList = 89
#Works well with static number - this generates
#the output of the title of news with uid=2:
#uidInList = 2
#However we do want to create a dynamic output
#of the title of the currently selected tt_news article
#(doesn't work):
uidInList.field = uid
#This doesn't work either:
#uidInList = GP:tt_news[uid]
#uidInList = GP:tt_news|uid
#uidInList.data = GP:tt_news[uid]
#uidInList = tt_news.uid
andWhere{
data = GP:tx_ttnews|tt_news
wrap = uid = |
}
languageField = sys_language_uid
}
renderObj = COA
renderObj {
10 = TEXT
10 {
stdWrap.override.field = title
}
}
}
}
[end]
I stopped using tt_news long ago and converted to EXT:news, so I only guess.
As you already noticed is the formerly extraction of theuid of the current news record no longer working. Probably because the URL parameter has changed.
Try to identify the new parameter with a deactivation of realurl and look for the generated URLs for displaying a news in detail view.

How to use Page Ids retrieved from Database in the HMenu?

I'm currently working on my first typo project and need to create a mega menu with an individual set of pages.
Many attempts failed or are not suitable for me. My current shot aims to group pages of the redirect type in a hidden page. In Typoscript I want to set the ID of the parent page containing these redirections and read the shortcut IDs of the children accordingly.
pageIds = CONTENT
pageIds {
table = pages
select {
selectFields = shortcut
pidInList = 614 # Id of the container Page
}
}
The next step would be to use the retrieved shortcut IDs in my HMENU of the type 'list'.
1 = HMENU
1 {
special = list
special {
value = # Assign retrieved IDs here
}
[...]
}
Typoscript is very confusing at first sight, so I would be glad to receive some hints how I can transfer the query's result, as a comma-seperated list, to the HMENU.
Thanks in advance!
Greetz.
First, you need to get a comma-separated list of the page UIDs you want to link. This can be achieved with a renderObj:
lib.pageIds = CONTENT
lib.pageIds {
table = pages
select {
selectFields = shortcut
pidInList = 614 # Id of the container Page
}
renderObj = TEXT
renderObj.stdWrap.field = shortcut
renderObj.stdWrap.wrap = |,
}
This should give you a comma-separated list of all records. Now you must apply these to the HMENU. As you can read in the documentation, the value property is stdWrap enabled, this means that you can copy a value when you use a cObject:
1 = HMENU
1 {
special = list
special {
value.cObject < lib.pageIds
}
[...]
}
I didn't test this, so maybe the configuration is not entirely complete.

TYPO3: how to include other columns in section index?

I have a website with two columns (colPos = 0 and colPos = 2). Haw can I include headers from column 2 into the section index? The default behavior is to include only headers from column 0.
More specifically, here is the TypoScript I use to generate the menu:
lib.menupage = HMENU
lib.menupage {
1 = TMENU
1 {
wrap = <ul> | </ul>
NO.wrapItemAndSub = <li> | </li>
sectionIndex = 1
}
}
I'm using TYPO3 6.0.
i guess you are searching for
lib.menupage.1.sectionIndex.useColPos = -1
(But this seems to be only available in TYPO3 6.0)
As a workaround it should be possible to do it on your own. Render a normal menu, but override (allWrap.cObject should do the job) the link with an CONTENT Object, which retrieves all headers from tt_content of that page. Here is some pseudo-code which help to explain how i would try to solve that problem. This code will not work, just show the principle:
lib.menupage = HMENU
lib.menupage {
1 = TMENU
1 {
wrap = <ul> | </ul>
NO.wrapItemAndSub = <li> | </li>
# pgampe suggested to use: stdWrap2.append instead of allWrap.cObject. My intention
# was to override the original link at all. But you should be able to play with
# the different stdWrap functions to get the best solution
# as far as i remember, allWrap will be wrapped by "wrapItemAndSub"
NO.allWrap.cObject = CONTENT
NO.allWrap.cObject {
table = tt_content
select {
# the uid is the id of the page where we need the content from
pidInList.field = uid
orderBy = colPos, sorting
}
# inside the renderobj we get the elements which are retrieved by CONTENT
renderObj = TEXT
renderObj {
field = header
typolink.parameter.field = pid
typolink.section.field = uid
required = 1
wrap = <span class="inside-li">|</span>
}
}
}
}
You are most likely looking for the section index function in the menu content object.
The rendering is defined in tt_content.menu.20.3.stdWrap.prepend.20 = CONTENT. You can use the TSOB (TypoScript Object Browser) to investigate the relevant typoscript setup.
You can adjust it to your needs like any CONTENT object in TYPO3. However it should already select any column (at least in 6.0).

Illustrate content from FCE in another way

I have some FCEs which are working fine. Now I want to display the data for another render type and I have to change from div to ul. Is there a way to extract the data fields with Typoscript? Currently the FCEs are included as Page-Content Elements in another template. The data processing contains the following TS Code
10= RECORDS
10.source.current=1
10.tables = tt_content
10.wrap = <!--TYPO3SEARCH_begin--> | <!--TYPO3SEARCH_end-->
#ggzone:
I tried this:
10 = COA
10 {
10 = TEXT
10 {
current = 1
typolink.parameter.field = field_link_text
required = 1
wrap = <h3>|</h3>
}
}
But I only get <h3>39,40,57</h3>. That are the IDs from the FCEs. How do I get the field value?
ofcourse... this is an example how to render a FCE... u can also use a Typoscript select in there from tt_content. there are many snippets outside. for example just replace your snippet with this one just to see if it works. dont forget to edit the "field_yourfieldname" to your field_xxxx
10 = COA
10 {
10 = TEXT
10 {
current = 1
typolink.parameter.field = field_yourfieldname
required = 1
wrap = <h3>|</h3>
}
}
typolink is not the only where you can use .field as typolinks uses the ID to link to a page (&id=123) you will get it. you can also use value.field or stdWrap.field.
heres another example which should work:
10 = HTML
10.value.field = field_yourfieldname
take a look aroun in google.. its not easy to find some snippets but also not that hard. as i use this not often i also need to take a look around everytime