I want to get the pagetitle of the current page I'm on in Typo3. I want to wrap a div - Box for a Hmenu. That works, but I also want the Title in the div to be the title of the current page. My typoscript looks like this
temp.pagetitle = TEXT
temp.pagetitle.field=title
page=PAGE
page.typeNum = 0
page.10.marks.LEFT_MENU = HMENU
page.10.marks.LEFT_MENU {
special = directory
special.value = {$pwcms.linkesMenu.rootSeitenID}
excludeUidList = {$pwcms.linkesMenu.nichtSichtbareSeiten}
stdWrap.preCObject < temp.pagetitle
stdWrap.wrap = <div class="bigBox shadow"> <div class="csc-header csc-header-n1">
<h1 class="csc-firstHeader">temp.pagetitle</h1></div>| </div>
stdWrap.wrap.insertData = 1
If I save these settings and reload the page, the caption in my div Box just says "temp.pagetitle"
I guess it should be some kind of this way:
page = PAGE
page.typeNum = 0
page.10.marks.LEFT_MENU = HMENU
page.10.marks.LEFT_MENU {
special = directory
special.value = {$pwcms.linkesMenu.rootSeitenID}
excludeUidList = {$pwcms.linkesMenu.nichtSichtbareSeiten}
stdWrap.preCObject = TEXT
stdWrap.preCObject.data = page : file
stdWrap.preCObject.wrap = <div class="bigBox shadow"> <div class="csc-header csc-header-n1">
<h1 class="csc-firstHeader"> | </h1> </div> </div>
}
Related
I want to create a popup menu with content elements of the items.
The structure in the backend is basically as follows:
Menu1
Submenu1.1
Submenu1.2
Submenu1.3
Menu2
Submenu2.1
Submenu2.2
Submenu2.3
Where Menu1 and Menu2 have content elements on the page.
I managed to access the content elements, however, the elements are rendered BEFORE the sub menu items. I need them after that.
What I get:
<div class="headeroverlay">
<div class="dropdown-overlay" id="overlay_4">
<!-- CONTENT ELEMENTS -->
<div class="contentimagesandtext">
<div class="item"><!-- Content Element 1 of Menu 1 --></div>
<div class="item"><!-- Content Element 2 of Menu 1 --></div>
</div>
<!-- SUB MENU -->
<div class="subnav-block">
<div class="subnav-link">Submenu1.1</div>
<div class="subnav-link">Submenu1.2</div>
<div class="subnav-link">Submenu1.3</div>
</div>
</div>
<div class="dropdown-overlay topdropdown" id="overlay_5">
<!-- same for Menu 2 -->
</div>
</div>
But I need content and submenu switched:
<div class="headeroverlay">
<div class="dropdown-overlay" id="overlay_4">
<!-- SUB MENU -->
<div class="subnav-block">
<div class="subnav-link">Submenu1.1</div>
<div class="subnav-link">Submenu1.2</div>
<div class="subnav-link">Submenu1.3</div>
</div>
<!-- CONTENT ELEMENTS -->
<div class="contentimagesandtext">
<div class="item"><!-- Content Element 1 of Menu 1 --></div>
<div class="item"><!-- Content Element 2 of Menu 1 --></div>
</div>
</div>
<div class="dropdown-overlay topdropdown" id="overlay_5">
<!-- same for Menu 2 -->
</div>
</div>
Here's my script so far:
lib.menuOverlay = HMENU
lib.menuOverlay{
1 = TMENU
1.expAll = 1
1.NO.doNotShowLink = 1
1.NO.wrapItemAndSub = <div class="dropdown-overlay topdropdown" id="overlay_{field:uid}">|</div>
1.NO.wrapItemAndSub.insertData = 1
# Append Content Elements to stdWrap2
1.NO.stdWrap2.append = CONTENT
1.NO.stdWrap2.append {
table = tt_content
select {
pidInList.stdWrap.data = field:uid
}
wrap = <div class="contentimagesandtext">|</div>
renderObj.stdWrap.wrap = <div class="item">|</div>
}
2 = TMENU
2.insertData = 1
2.wrap = <div class="subnav-block">|</div>
2.NO.wrapItemAndSub = <div class="subnav-link">|</div>
}
I tried adding the append to wrapItemAndSub. This will put the content elements after the submenus, but then I don't have a wrapper keeping them togehter.
Note that I need the Level-1 Page UID in the id tag of the wrapper
Question: How can I force the append to be AFTER the items, or alternatively, how can I add a wrapper around my wrapItemsAndSub, containing the parent UID?
you should care for your wraps.
you use stdWrap2 where you append your content. The append wraps the wrap-string of stdWrap2(which is empty), leaving the append the only value for stdWrap2.
now stdWrap2 has no marker where to split the wrap in before and after. So everything goes before the wrapped content. You need a split-marker in stdWrap2:
stdWrap2 = |
stdWrap2.append = ...
on the other side: you could use append as the only wrapping to get its value after the content.
Inspired by this answer, I managed to do what I need.
I append a COA to my first level menu, and put there the CONTENT and another HMENU with the sub-menu items, like this:
lib.menuOverlay = HMENU
lib.menuOverlay {
1 = TMENU
1.expAll = 1
1.NO.doNotShowLink = 1
1.NO.wrapItemAndSub = <div class="dropdown-overlay topdropdown" id="overlay_{field:uid}">|</div>
1.NO.wrapItemAndSub.insertData = 1
1.NO.stdWrap2.append = COA
1.NO.stdWrap2.append {
10 = HMENU
10 {
special = directory
special.value.data = field:uid
1 = TMENU
1.insertData = 1
1.wrap = <div class="subnav-block">|</div>
1.NO.wrapItemAndSub = <div class="subnav-link">|</div>
}
20 = CONTENT
20 {
table = tt_content
select {
pidInList.stdWrap.data = field:uid
}
wrap = <div class="contentimagesandtext">|</div>
renderObj.stdWrap.wrap = <div class="item">|</div>
}
}
}
I tried to use ATagParams in TypoScript, but the parameter isn't shown in any menu links. A code like this was working in TYPO3 6.2, but not in TYPO3 8.5.1. What am I doing wrong? Or is it a bug in TYPO3?
lib.mainNav = HMENU
lib.mainNav {
special = directory
special.value = 1
wrap = <nav id="main-nav" class="ui top attached tabular menu">|</nav>
1 = TMENU
1 {
NO {
allWrap = <div class="item" data-tab="mainitem{elementUid}">|</div>
subst_elementUid = 1
ATagParams = class="navlink_inactive"
}
ACT = 1
ACT {
allWrap = <div class="item active" data-tab="mainitem{elementUid}">|</div>
subst_elementUid = 1
ATagParams = class="active"
}
}
}
Works for me in 8.6.0.
Maybe you override it in a later TypoScript?
Look into TypoScript Object Browser or/and Template Analyzer.
in my TYPO3 7.5 project I have created some custom page types by registering them in ext_tables.php as described further here
I can select those page types in the backend, no errors, all good. Also checking for a certain page-type via statements in the frontend works fine.
Now I want to create a menu of those (sub-)page trees. The TypoScript solution looks like this and works fine:
lib.tourTeasers = HMENU
lib.tourTeasers {
special = directory
wrap = <section class="row">|</section>
1 = TMENU
1 {
wrap = <div class="col-sm-12">|</div>
expAll = 1
NO {
doNotLinkIt = 1
linkWrap = <h2 style="text-align:right">Kategorie: |</h2>
}
}
2 = TMENU
2{
expAll = 1
NO{
doNotLinkIt = 1
linkWrap = <h3>Tourtyp: |</h3>
}
}
3 = TMENU
3{
NO{
doNotLinkIt = 1
linkWrap = <h4>|</h4>
after.cObject = COA
after.cObject {
stdWrap.dataWrap = <div class="row teaser">|</div>
10 = FILES
10 {
references {
table = pages
fieldName = media
}
renderObj=IMAGE
renderObj{
file{
width=300c
height=150c
#maxW=257c
#maxH=150c
import.data= file:current:publicUrl
}
altText.data = file:current:title
#altText.field=abstract
#titleText.field=nav_title
#stdWrap.dataWrap = |</a>
stdWrap.dataWrap(
<a href="index.php?id={field:uid}" title="Tour {field:title} ansehen">
<div class="col-sm-4 teaser__image">|</div>
</a>
)
params = class="img-responsive"
}
}
30 = TEXT
30.field = abstract // bodytext
30.crop = 250
30.wrap = <div class="col-sm-8 teaser__description"><p>|</p>
40 = TEXT
40.value = Ansehen
40.typolink.parameter.field = uid
40.typolink.ATagParams = class="btn"
40.wrap = <div class="button teaser__cta">|</div></div>
}
}
}
}
My problem is:
If I use the very Fluid Viewhelper that is intended to render exacly the same
<v:page.menu.directory pages="{page_uid}" as="tours" expandAll="true">
<f:for each="{tours}" as="tour">
<div class="row">
<div class="col-sm-3">
<v:page.resources.fal table="pages" field="media" uid="{tour.uid}" as="images">
<f:for each="{images}" as="image">
<f:image src="{image.url}" alt="{image.alternative} {image.name}" title="{image.title}" class="img-responsive"/>
</f:for>
</v:page.resources.fal>
</div>
<div class="col-sm-9">
<h3>{tour.title}</h3>
{tour.abstract}
</div>
</div>
</f:for>
</v:page.menu.directory>
{page_uid} being the parent page, nothing is displayed.
If I change some of the sub-pages' doktype back to "default" they are displayed in the rendered menu.
any idea as to why this is? Am i missing a certain argument in the viewhelper? i also tried to set the allowed doktypes in the viewhelper but that doesn't change anything.
thanks for the reponses, indeed it had to do with the doktype, is I didn't include the "new" ones for both the parent pages AND their sub-pages. Works now, solved. Fluid really rocks
how can I replace programmatically via TypoScript the content of {content_left} in a single page via USER_INT with individual PHP content.
<div class="container">
<div class="header span-28">
<f:format.raw>{header}</f:format.raw>
</div>
<img class="logo" src="../fileadmin/logo.png" alt="logo">
<img class="headerimg" src="../fileadmin/header_img.png" alt="headerimg">
<div class="menu span-28">
<f:format.raw>{main_menu}</f:format.raw>
</div>
<div class="service span-28">
<f:format.raw>{service_menu}</f:format.raw>
</div>
<div class="content span-6 append-1">
<f:format.raw>{content_left}</f:format.raw>
</div>
<div class="content span-22 last">
<f:format.raw>{content_right}</f:format.raw>
</div>
<div class="footer span-28 last">
<f:format.raw>{footer}</f:format.raw>
</div>
</div>
My current TypoScript does look like this:
#
temp.info = USER_INT
temp.info {
userFunc = user_various->listContentRecordsOnPage
reverseOrder = 1
debugOutput = 1
}
page.content_left < temp.info
But it does not work. :( No replacement is done.
Thanks for any help.
Cheers
kk3003
gsnerf is absolutety right, it's a FLUIDTEMPLATE element.
Unfortunately this TYPOSCRIPT set to the single page where it should appear does not work, any ideas please?
# Include the PHP file with custom code
includeLibs.user_various = fileadmin/php/example_listRecords.php
#
temp.info = USER_INT
temp.info {
userFunc = user_various->listContentRecordsOnPage
}
page = PAGE
page {
typeNum = 0
metaCharset = utf-8
includeCSS{
file10 = fileadmin/css/blueprint/screen.css
file20 = fileadmin/css/blueprint/print.css
file20.media = print
file100 = fileadmin/css/main.css
file300 = fileadmin/css/service.css
file400 = fileadmin/css/mainMenu.css
file500 = fileadmin/css/sliding-box.css
file600 = fileadmin/css/gridelements.css
}
includeJS {
file10 = fileadmin/js/accordion.js
}
}
[browser = msie]
page.includeCSS.file30 = fileadmin/css/blueprint/ie.css
page.includeCSS.file30.media = screen
[global]
page.meta {
MSSmartTagsPreventParsing = true
imagetoolbar = false
}
# https_enforcer
page.5 < plugin.tx_httpsenforcer_pi1
# Create a Fluid Template
page.10 = FLUIDTEMPLATE
page.10 {
# Set the Template Pathes
file = fileadmin/templates/html/template.html
partialRootPath = fileadmin/templates/html/partials/
layoutRootPath = fileadmin/templates/html/layouts/
variables {
header < lib.header
content_left < lib.contentLeft
content_right < temp.info
main_menu < lib.mainMenu
service_menu < lib.serviceMenu
footer < lib.footer
}
}
Thanks
I'm not sure what this is supposed to have to do with templavoila? This seems more like fluid to me. If that is the case you have to replace your
page.content_left < temp.info
with the following:
10 = FLUIDTEMPLATE
10 {
[...]
variables.content_left < temp.info
}
Assuming you already have a FLUIDTEMPLATE definition you only need to copy the variables line into that one.
I dont come forth. I want to wrap each given PID in its own unique wrap.
Here my code:
menutab.list = HMENU
menutab.list.special = directory
menutab.list.special.value = 7,8,9,10,11,12,13
menutab.list.1 = TMENU
menutab.list.1.wrap = <div>|</div>
...
So thats working fine. I get every submenu of given PIDs but now i'm searching for something like that:
menutab.list.special.value.wrap = <div id="current PID!"> | </div>
I hope someone understand my issue.
Big thanks!!
It depends which field you would like to display, but basically any field from the page record can be displayed into the output.
menutab.list = HMENU
menutab.list {
special = directory
special.value = 7,8,9,10,11,12,13
1 = TMENU
1 {
# stdWrap2 wraps the whole item, including the link
NO.stdWrap2.dataWrap = <div id="p{field:uid}">|</div>
}
}
This will give the following output:
<div id="p26">Test 0</div>
<div id="p27">Test 1</div>
<div id="p30">Test 2</div>
<div id="p31">Test 3</div>
<div id="p35">Test 4</div>
<div id="p36">Test 5</div>
<div id="p37">Test 6</div>
For more options, please take a look at the TSref and the stdWrap functions.
TSref
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.4.0/view/toc/0/
stdWrap
http://typo3.org/documentation/document-library/references/doc_core_tsref/4.4.0/view/1/5/#id2618234
I think the easiest is to do something like that, not sure of the syntax... :
menutab.list.1 = HMENU
menutab.list.1 {
special = directory
special.value = 7
1 = TMENU
1.wrap = <div id="7"> | </div>
}
menutab.list.2 < menutab.list.1
menutab.list.2.special.value = 8
menutab.list.2.1.wrap = <div id="8"> | </div>
...
Not the best solution, but can work