Reputation: 493
Im setting up a new site on typo3 with a bootstrap carousel in the header. This carousel is on top of every page of the site, so I created a partial for that. The Problem is I want the pictures of the carousel to be exchangeable through the backend. So I created an image-element on a hidden site and tried to get the pictures with typoscript. So far it looks like this:
lib.slider=CONTENT
lib.slider {
table=tt_content
wrap=<div class="item"><img src="|" /></div>
select {
pidInList=12
where=uid=10
}
}
I get the pictures this way and they are shown in the slider but only in a formatted way with alls this <csc-textpic>
-crap around it. Is there a way to get just the image path so that it just needs to be wrapped by <img src""/>
? Or if there is a more elegant way to insert the carousel I'm also open to new suggestions.
Upvotes: 0
Views: 2609
Reputation: 6133
Instead of using a content element on a hidden page you can use the "Resources" tab of a page, where you can upload files (in your case images). Usually you use the page on the top level of your TYPO3 pagetree for this, so you can inherit selected images to all subpages.
After you have uploaded/selected your images to the page, you can use the following TypoScript to render your image slider.
lib.slider = FILES
lib.slider {
references {
data = levelmedia:-1, slide
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:uid
file.treatIdAsReference = 1
altText.data = file:current:title
wrap = <div class="slide">|</div>
}
stdWrap.wrap = <div class="slider">|</div>
}
In the example above I use levelmedia:-1, slide
to inherit the selected images from the current page to all subpages. Remove all wraps in the example above if you just want to output img
tags in the frontend.
Upvotes: 4