I was wondering if you can apply some text formatting to ATagParams in TMENU -
in case you need to have something like:
<a class="button category-button category-living" href="living/">Living</a>
Where "Living" is the Title of the page, as well as the specific classname.
To achieve some preprocessing for ATagParams values, one needs to create a cObject first:
ATagParams.stdWrap.cObject = TEXT
ATagParams.stdWrap.cObject {
case = lower
field = title
insertData = 1
wrap = class="button category-button category-|"
}
works like a charm.
Related
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.
I'm having a big teaser image at the top of the page. The author may select in the backend whether the teaser image should be static or a animated slideshow. I'm using bootstrap for the slideshow btw.
The selection appears at Page > Edit > Appearance
Rootpage TSConfig:
TCEFORM.pages {
layout.altLabels.1 = Default (with Slideshow)
layout.altLabels.0 = Default
}
Now, it gets a bit trickier.
To get the Bootstrap slider running, you need to have an outer wrap and each slide wrapped, too. This is what I've got so far:
page.10.variables {
teaser < styles.content.get
teaser.select.where = colPos = 0
teaser.stdWrap.required = 1
teaser.stdWrap.wrap {
cObject = CASE
cObject {
key.field = layout
default = TEXT
default.value = |
1 = TEXT
1.value = <div id="teaser" ...>|</div> ### shortened
}
}
teaser.renderObj.stdWrap.wrap {
cObject = CASE
cObject {
key.field = layout
default = TEXT
default.value = |
1 = TEXT
1.value = <div class="item">|</div>
}
}
}
The first teaser.stdWrap.wrap works like a charm. Selecting the Frontend Layout wraps the teaser correspondingly.
But the teaser.renderObj.stdWrap.wrap doesn't want to work. Mainly, because I think that the key of the CASE is not the Frontend Layout, but the layout of the content element. How to change that?
Second question. This is how the wraps currently look like (or how they would look if the TS above would work as intended):
<div class="item">
<div id="c14">
<div class="ce-textpic ce-right ce-intext">
<div class="ce-gallery" data-ce-columns="1" data-ce-images="1">
<div class="ce-row">
<div class="ce-column">
<div class="ce-media">
<img src="img.jpg" width="1150" height="632" alt="">
</div>
</div>
</div>
</div>
<div class="ce-bodytext"></div>
</div>
</div>
Is there a way to make it look more or less like this?
<div class="item">
<img class="slide" src="img.jpg">
</div>
The customer doesn't wish to have any captions or text, so it can be ignored.
I'm running TYPO3 7.6.6 with fluid_styled_content.
So the answer for the 1st question:
You can use the "getText" data type in TypoScript. See in doc here.
It has a predefined variable for the current page record. So simple change the second key attribute so:
key.data = page:layout
But if you are running the system with fluid_styled_content, then you can simply use fluid to solve this problem. (There you can access the layout with data.layout )
To answer the second question:
Yes. It is possible, you need to take a look into the fluid_styled_content extension. There you find a lot about the templates, layouts and the elements. You can simply override them with your templates and you can get rid of any not wanted div inside.
To do so, I can recommend you a german video.
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 to put the same value inside {againTheSameValue} for the menu in TypoScript? I want the same value for both text of a-tag and href-value:
[eg: Home]
Here's my TypoScript:
lib.mainmenu = HMENU
lib.mainmenu {
entryLevel = 0
1 = TMENU
1{
wrap = <li class="hidden"></li><ul class="nav navbar-nav navbar-right"> | </ul>
noBlur = 1
NO = 1
NO {
#
# I want the href too have the same value as set by "|" for it's text
#
wrapItemAndSub = <li><a class="page-scroll" href="#">|</a></li>
doNotLinkIt = 1
stdWrap.htmlSpecialChars = 1
ATagTitle.field = title
ATagParams = class="page-scroll"
}
}
}
Please suggest.
You can play around with stdWrap and field:...:
wrapItemAndSub = <li><a class="page-scroll" href="#{field:title}">|</a></li>
wrapItemAndSub.insertData = 1
In case you want to manipulate your href attribute (e.g. make it lowercase), the code must be written the other way round:
wrapItemAndSub = <li><a class="page-scroll" href="#|">{field:title}</a></li>
wrapItemAndSub.insertData = 1
stdWrap.case = lower
As you see, you can't apply stdWrap to {field:...}, but you can swap positions in wrapItemAndSub and apply stdWrap to a menu item text.
Tested both variants under 7.3 - works.
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