Typolink with text - typo3

I have a simple text element with a variable src value. What I want to do is to make a typolink around that.
footerlogo = TEXT
footerlogo {
value = {$footerlogo}
wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
}
Output should look like this:
<div class="elRightImg"> ... </div>

You want to look for the typolink function and its property ATagBeforeWrap :)
footerlogo = TEXT
footerlogo {
value = {$footerlogo}
typolink.parameter = http://www.example.com
typolink.wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
typolink.ATagBeforeWrap = 1
}
Should work.
Documentation:
https://docs.typo3.org/typo3cms/TyposcriptIn45MinutesTutorial/TypoScriptFunctions/Typolink/Index.html
https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html

Related

Typo3 Fluid renders html in the frontend instead of including the html to the homepage

i am trying to use Typo3 Fluid with Backendlayouts. But instead of rendering the Content Elements it renders the Html of the Content elements. For example i have a simple Text-Element in the Backend with "some text". It will show <p>some text</p> in the Frontend not "some text" as expected. The html of the homepage looks like this:
<p>
<p>test</p>
</p>
The viewhelper i used to render the content looks like this:
<div class="col-md-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="{pageUid: '{data.uid}', colPos: '11'}" />
</div>
As you can see there is no <p></p> tag at all in my Default.html.
I know that the Text element itself uses the <p> </p> Tags in the backend but i am surprised they get rendered as text and also included in the html. I just want the html of the Contentelement to be included in the html of the homepage
I guess the mistake could be in this typoscript for the lib.dynamicContent in my custom theme extension:
lib.dynamicContent = COA
lib.dynamicContent {
10 = LOAD_REGISTER
10 {
colPos.cObject = TEXT
colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
pageUid.cObject = TEXT
pageUid.cObject {
field = pageUid
ifEmpty.data = TSFE:id
}
contentFromPid.cObject = TEXT
contentFromPid.cObject {
data = DB:pages:{register:pageUid}:content_from_pid
data.insertData = 1
}
wrap.cObject = TEXT
wrap.cObject {
field = wrap
}
}
20 = CONTENT
20 {
table = tt_content
select {
includeRecordsWithoutDefaultTranslation = 1
orderBy = sorting
where = {#colPos}={register:colPos}
where.insertData = 1
pidInList.data = register:pageUid
pidInList.override.data = register:contentFromPid
}
stdWrap {
dataWrap = {register:wrap}
required = 1
}
}
30 = RESTORE_REGISTER
}
This is the Default.html
<f:layout name="Default" />
<f:section name="Main">
<main role="main">
<div class="container">
<div class="row">
<div class="col-md-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="pageUid: '{data.uid}', {colPos: '11'}" />
</div>
<div class="col-md-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="pageUid: '{data.uid}', {colPos: '12'}" />
</div>
<div class="col-md-4">
<f:cObject typoscriptObjectPath="lib.dynamicContent" data="pageUid: '{data.uid}', {colPos: '13'}" />
</div>
</div>
</div>
</main>
</f:section>
Thank you for your time and please comment if you need more information to be able to help me.
Daniel
I found the mistake and it was a basic one i guess. I did not include the Fluid Content Elements Css - only the Fluid Content Elements. Thanks for your input. If you have this problem include it in your typoscript or in your root-template in the backend. It should appear in "includes"
Probably missing a <f:format.raw> around your Content fluid will htmlescape by default

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

tt_news: wrap around image including caption?

I am trying to get a wrapper element around an image including its caption in the single view in tt_news for Typo3 6.1. How would I do that?
So far I only figured out how to do that for either all images
plugin.tt_news.displaySingle.imageWrapIfAny = ...
or the caption itself
plugin.tt_news.displaySingle.caption_stdWrap.dataWrap = ...
. But I have no clue how to create a wrapper for each single image including its caption...
Thanks in advance!
I know this is quite old, but as a follow-up that works in TYPO3 6.x you can use:
displaySingle.image.wrap = <div class="news-img">|
displaySingle.caption_stdWrap >
displaySingle.caption_stdWrap.wrap = <p class="news-single-imgcaption">|</p></div>
So each image and caption gets wrapped by <div class="news-img">...</div>
The following HTML will be provided by the below TS:
<div class="newsImage">
<div class="imageHolder">
<img />
</div>
<div class="captionHolder">
Caption
</div>
</div>
TypoScript:
displaySingle {
imageWrapIfAny = <div class="newsImage">|</div>
image {
file.maxW >
file.maxH >
file.width = 220
stdWrap.wrap = <div class="imageHolder">|</div>
altText.field = imagealttext
}
caption_stdWrap >
caption_stdWrap.wrap = <div class="captionHolder">|</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