show field from FCE only when it is not empty - typo3

I'm currently mapping my FCE in Templavoila. The user has an input field and should enter a text. If no text is entered the element should not be shown. Therefore I have this Typoscript Code:
10 = TEXT
10.value.field = field_member_tel
10.wrap = T: <span class="team-member-tel-content"> | </span>
10.if.isTrue.field = field_member_tel
10.value.field is not working. My output is only the T:. How do I get the value from the field?
Perhaps I should mention that this element is in a container if that makes a difference.
EDIT:
This leads to the same result:
10 = TEXT
10.value = {field_member_tel}
10.insertData = 1
10.wrap = T: <span class="team-member-tel-content"> | </span>
10.if.isTrue.field = field_member_tel
This is working, but I don't need a typolink here:
10 = TEXT
10.typolink.parameter.field = field_member_email
10.typolink.title.field = field_member_name
10.wrap = E: <span class="team-member-email-content"> | </span>
10.if.isTrue.field = field_member_email

Thanks to Merec. The solution looks like this:
10 = TEXT
10.field = field_member_tel
10.wrap = T: <span class="team-member-tel-content"> | </span>
10.if.isTrue.field = field_member_tel

Related

How to set tx_news (TYPO3) title in breadcrumb WITH link

I implemented tx_news title in breadcrumb always like shown here with typoscript: How to set breadcrumb for tx_news TYPO3 and it works fine but for now i need to get an link on the news title which points to itself. This is needed for structurel data correctness (https://schema.org/). See structurel data testing tools on any news single view for that issue. I didn't get that to work and don't find any hints online beside the above one.
Is that possible in any way?
What about
lib.url = TEXT
lib.url.data = getIndpEnv:TYPO3_REQUEST_URL
Thanks for the hint. This did the job for me:
[globalVar = GP:tx_news_pi1|news > 0]
lib.menu.breadcrumb.20 = COA
lib.menu.breadcrumb.20 {
wrap = <li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem" class="active"> | <meta itemprop="position" content="2" /></li>
10 = TEXT
10.wrap = <a href="|" target="_top" itemprop="item">
10.data = getIndpEnv:TYPO3_REQUEST_URL
20 = RECORDS
20 {
dontCheckPid = 1
tables = tx_news_domain_model_news
source.data = GP:tx_news_pi1|news
source.intval = 1
conf.tx_news_domain_model_news = TEXT
conf.tx_news_domain_model_news.field = title
conf.tx_news_domain_model_news.htmlSpecialChars = 1
wrap = <span itemprop="name">|</span>
}
30 = TEXT
30.value = </a>
}
[end]

Time condition not working in typoscript

I try to display a message, if it is 11 oclock.
This is what I've tried:
temp.contentHome.20 {
wrap = <div class="clearfix heading_wrapper">|</div>
10.stdWrap.wrap = <div class="col-xs-12 col-sm-4 col-md-2 image-left">|</div>
20.wrap = <div class="col-xs-12 col-sm-8 col-md-7 text-center">|</div>
30 = TEXT
30.value = <p>default</p>
30.stdWrap.wrap = <div style="margin-top: 1em" class="col-xs-12 col-sm-12 col-md-3 text-right">|</div>
}
[hour = 11]
temp.contentHome.20.30.value = <p>Success! It is 11 o'clock</p>
[ELSE]
temp.contentHome.20.30.value = <p>It is not 11 o'clock!</p>
[END]
However, the output is always It is not 11 o'clock!, even though it is 11 oclock like date proves.
Why is the condition not working?
On the first look it seems to be correct.
Try to add the current time to the COA:
temp.contentHome.20.40 = TEXT
temp.contentHome.20.40 {
data = date:U
strftime = %H:%M
}
Maybe your server time doesn't match your localtime. Please Check the timezone settings in the install tool ([SYS][phpTimeZone]).
Also it is possible that the caching is not refreshed so the condition is not checked.
To the end: Have you an COA or COA_INT on temp.contentHome.20?

TYPO3 - Custom page types not showing in menu

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

Get current pagetitle in Typo3 in Hmenu

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

TYPO3 TMENU each special.value wrap

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