I have a custom requirement to display an image slider using TypoScript. The images are taken from default tt_content image content element.
I've added the following TypoScript code to implement this;
lib.homeslider = COA
lib.homeslider {
10 = CONTENT
10 {
table = tt_content
select {
where = colPos = 3
andWhere = deleted = 0
andWhere = hidden = 0
orderBy = rand()
}
renderObj = FILES
renderObj {
references {
table = tt_content
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:uid
file.treatIdAsReference = 1
stdWrap.typolink.parameter.data = file:current:link
stdWrap.wrap = <div class="item active">|</div>|*|<div class="item">|</div>|*|<div class="item">|</div>
}
}
}
wrap = <div id="carousel-example-generic" data-ride="carousel" class="carousel slide carousel-fade"><div role="listbox" class="carousel-inner">|</div></div>
}
This displayed the images in frontend. But my requirement is I want to add class "active" to the first image wrapper. I've added the following code to implement this, but not working.
stdWrap.wrap = <div class="item active">|</div>|*|<div class="item">|</div>|*|<div class="item">|</div>
Final HTML output I need to generate is;
<div id="carousel-example-generic" data-ride="carousel" class="carousel slide carousel-fade">
<div role="listbox" class="carousel-inner">
<div class="item active">
<a href="#">
<img src="images/temp/startbild1.jpg" alt="#">
</a>
</div>
<div class="item">
<a href="#">
<img src="images/temp/startbild2.jpg" alt="#">
</a>
</div>
<div class="item">
<a href="#">
<img src="images/temp/startbild3.jpg" alt="#">
</a>
</div>
</div>
</div>
If anybody knows the solution, then please help me.
Your original TS is fine.
Supposing you have the images in the same CE (Content element), not in several CEs. As such:
For easier readability, I have modified the following line:
Which gives me:
EDIT: try for random content