TYPO3 FLUID grouping and limiting elements while looping - typo3

I'm trying to make FLuID loop which will display block with the 4 pictures. I would like to achieve something like this:
<div class="carousel-inner">
<div class="item active">
<div data-target="#carousel" data-slide-to="0" class="thumb"><img src="http://image1.jpg"></div>
<div data-target="#carousel" data-slide-to="1" class="thumb"><img src="http://image2.jpg"></div>
<div data-target="#carousel" data-slide-to="2" class="thumb"><img src="http://image3.jpg"></div>
<div data-target="#carousel" data-slide-to="3" class="thumb"><img src="http://image4.jpg"></div>
</div>
<div class="item">
<div data-target="#carousel" data-slide-to="4" class="thumb"><img src="http://image5.jpg"></div>
<div data-target="#carousel" data-slide-to="5" class="thumb"><img src="http://image6.jpg"></div>
<div data-target="#carousel" data-slide-to="6" class="thumb"><img src="http://image7.jpg"></div>
<div data-target="#carousel" data-slide-to="7" class="thumb"><img src="http://image8.jpg"></div>
</div>
</div>
The problem is that I'm newbie in FLUID stuff and don't know how to make loop with only 4 elements. My FLUID loop looks like that:
<div class="carousel-inner">
<f:for each="{paginatedAssets}" as="mediaAsset" iteration="iterator">
<f:if condition="{iterator.index} = 4">
<div class="item{f:if(condition: '{iterator.index} == 0', then: ' active')}">
<div data-target="#carousel" data-slide-to="{iterator.index}" class="thumb">
<f:render partial="MediaAsset/Detail" section="Detail" arguments="{alt:mediaAsset.alternative,title:mediaAsset.title,mediaAsset:mediaAsset,width:settings.album.thumb.width,height:settings.album.thumb.height,resizeMode:settings.album.thumb.resizeMode}" />
</div>
</div>
</f:if>
</f:for>
</div>
But it display something like that:
<div class="carousel-inner">
<div class="item active">
<div data-target="#carousel" data-slide-to="0" class="thumb">
<img title="Photo 1" alt="Photo 1" src="fileadmin/_processed_/csm_P1320323_f0d26808a1.jpg" width="800" height="600" />
</div>
</div>
<div class="item">
<div data-target="#carousel" data-slide-to="1" class="thumb">
<img title="Photo 2" alt="Photo 2" src="fileadmin/_processed_/csm_P1320326_d00a6dfa33.jpg" width="800" height="600" />
</div>
</div>
...
<div class="item">
<div data-target="#carousel" data-slide-to="n" class="thumb">
<img title="Photo n" alt="Photo n" src="fileadmin/_processed_/csm_P1234567_f001234567.jpg" width="800" height="600" />
</div>
</div>
</div>
So every loop display only one (not 4) images. Any suggestions?
I will be grateful for any help.

You can use the isFirst, isLast and cycle properties of the iterator to achieve this:
<f:for each="{paginatedAssets}" as="mediaAsset" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<div class="item active">
</f:if>
<div data-target="#carousel" data-slide-to="{iterator.index}" class="thumb">
<f:render partial ... />
</div>
<f:if condition="{iterator.cycle} % 4">
<f:else>
</div>
<div class="item">
</f:else>
</f:if>
<f:if condition="{iterator.isLast}">
</div>
</f:if>
</f:for>

Related

TYPO3 VHS only get image Tag

I want to get only the img tag not the whole cObject. This is what I´ve done:
<v:content.render pageUid="{this.uid}" column="5" as="tcolsid">
<f:debug>{tcolsid.0}</f:debug>
<f:format.raw>{tcolsid.0}</f:format.raw>
</v:content.render>
This is what I get:
<div id="c3" class="frame frame-default frame-type-image frame-layout-0">
<div class="ce-image ce-center ce-above">
<div class="ce-gallery" data-ce-columns="1" data-ce-images="1">
<div class="ce-outer">
<div class="ce-inner">
<div class="ce-row">
<div class="ce-column">
<figure class="image">
<img class="image-embed-item" src="fileadmin/user_upload/cappucino.jpg" width="1500" height="1101" alt=""/>
</figure>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
And i only want to get the img tag:
<img class="image-embed-item" src="fileadmin/user_upload/cappucino.jpg" width="1500" height="1101" alt=""/>
Can someone help?
Maybe something like this?
<v:content.render pageUid="23" column="0" as="records" render="false">
<f:for each="{records}" as="record">
{v:resource.record.fal(table: 'tt_content', field: 'image', uid: '{record.uid}')
-> v:iterator.first()
-> v:variable.set(name: 'image')}
<f:if condition="{image}">
<v:media.image
alt="{f:if(condition: '{image.alternative}', then: '{image.alternative}', else: '{data.header}')}"
class="d-block w-100 img-fluid" crop="{image.crop}" src="{image.uid}"
srcsetDefault="1024" treatIdAsReference="1" />
</f:if>
</f:for>
</v:content.render>

Binding.scala - SBT Out Of Memory issues

I have a large #html function (125 lines) and after that sbt fails with OutOfMemory. I increased sbt's memory to 8g and same thing so it's not just it needed a little more memory.
Is this a known issue with Binding.scala?
sbt 1.3.2
scala 2.13.3
JDK11
scala js 1.1.1
"org.lrng.binding" %%% "html" % "1.0.3"
"com.thoughtworks.binding" %%% "binding" % "12.0.0"
#html def topNav: NodeBinding[Node] = {
<nav class="navbar navbar-light navbar-expand bg-white shadow mb-4 topbar static-top">
<div class="container-fluid">
<button class="btn btn-link d-md-none rounded-circle mr-3" id="sidebarToggleTop" type="button"><i class="fas fa-bars"></i></button>
<form class="form-inline d-none d-sm-inline-block mr-auto ml-md-3 my-2 my-md-0 mw-100 navbar-search">
<div class="input-group">
<input class="bg-light form-control border-0 small" type="text" placeholder="Search for ..."/>
<div class="input-group-append"><button class="btn btn-primary py-0" type="button"><i class="fas fa-search"></i></button></div>
</div>
</form>
<ul class="nav navbar-nav flex-nowrap ml-auto">
<li class="nav-item dropdown d-sm-none no-arrow">
<a class="dropdown-toggle nav-link" data-toggle="dropdown" aria-expanded="false" href="#"><i class="fas fa-search"></i></a>
<div class="dropdown-menu dropdown-menu-right p-3 animated--grow-in" role="menu" aria-labelledby="searchDropdown">
<form class="form-inline mr-auto navbar-search w-100">
<div class="input-group">
<input class="bg-light form-control border-0 small" type="text" placeholder="Search for ..."/>
<div class="input-group-append"><button class="btn btn-primary py-0" type="button"><i class="fas fa-search"></i></button></div>
</div>
</form>
</div>
</li>
<li class="nav-item dropdown no-arrow mx-1" data:role="presentation">
<li class="nav-item dropdown no-arrow">
<a class="dropdown-toggle nav-link" data-toggle="dropdown" aria-expanded="false" href="#"><span class="badge badge-danger badge-counter">3+</span><i class="fas fa-bell fa-fw"></i></a>
<div class="dropdown-menu dropdown-menu-right dropdown-list dropdown-menu-right animated--grow-in"
role="menu">
<h6 class="dropdown-header">alerts center</h6>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="mr-3">
<div class="bg-primary icon-circle"><i class="fas fa-file-alt text-white"></i></div>
</div>
<div>
<span class="small text-gray-500">December 12, 2019</span>
<p>A new monthly report is ready to download!</p>
</div>
</a>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="mr-3">
<div class="bg-success icon-circle"><i class="fas fa-donate text-white"></i></div>
</div>
<div>
<span class="small text-gray-500">December 7, 2019</span>
<p>$290.29 has been deposited into your account!</p>
</div>
</a>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="mr-3">
<div class="bg-warning icon-circle"><i class="fas fa-exclamation-triangle text-white"></i></div>
</div>
<div>
<span class="small text-gray-500">December 2, 2019</span>
<p>Spending Alert: We've noticed unusually high spending for your account.</p>
</div>
</a>
<a class="text-center dropdown-item small text-gray-500" href="#">Show All Alerts</a>
</div>
</li>
</li>
<li class="nav-item dropdown no-arrow mx-1" data:role="presentation">
<li class="nav-item dropdown no-arrow">
<a class="dropdown-toggle nav-link" data-toggle="dropdown" aria-expanded="false" href="#"><i class="fas fa-envelope fa-fw"></i><span class="badge badge-danger badge-counter">7</span></a>
<div class="dropdown-menu dropdown-menu-right dropdown-list dropdown-menu-right animated--grow-in"
role="menu">
<h6 class="dropdown-header">alerts center</h6>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="dropdown-list-image mr-3">
<img class="rounded-circle" src="assets/img/avatars/avatar4.jpeg"/>
<div class="bg-success status-indicator"></div>
</div>
<div class="font-weight-bold">
<div class="text-truncate"><span>Hi there! I am wondering if you can help me with a problem I've been having.</span></div>
<p class="small text-gray-500 mb-0">Emily Fowler - 58m</p>
</div>
</a>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="dropdown-list-image mr-3">
<img class="rounded-circle" src="assets/img/avatars/avatar2.jpeg"/>
<div class="status-indicator"></div>
</div>
<div class="font-weight-bold">
<div class="text-truncate"><span>I have the photos that you ordered last month!</span></div>
<p class="small text-gray-500 mb-0">Jae Chun - 1d</p>
</div>
</a>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="dropdown-list-image mr-3">
<img class="rounded-circle" src="assets/img/avatars/avatar3.jpeg"/>
<div class="bg-warning status-indicator"></div>
</div>
<div class="font-weight-bold">
<div class="text-truncate"><span>Last month's report looks great, I am very happy with the progress so far, keep up the good work!</span></div>
<p class="small text-gray-500 mb-0">Morgan Alvarez - 2d</p>
</div>
</a>
<a class="d-flex align-items-center dropdown-item" href="#">
<div class="dropdown-list-image mr-3">
<img class="rounded-circle" src="assets/img/avatars/avatar5.jpeg"/>
<div class="bg-success status-indicator"></div>
</div>
<div class="font-weight-bold">
<div class="text-truncate"><span>Am I a good boy? The reason I ask is because someone told me that people say this to all dogs, even if they aren't good...</span></div>
<p class="small text-gray-500 mb-0">Chicken the Dog · 2w</p>
</div>
</a>
<a class="text-center dropdown-item small text-gray-500" href="#">Show All Alerts</a>
</div>
</li>
<div class="shadow dropdown-list dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown"></div>
</li>
<div class="d-none d-sm-block topbar-divider"></div>
<li class="nav-item dropdown no-arrow" data:role="presentation">
<li class="nav-item dropdown no-arrow">
<a class="dropdown-toggle nav-link" data-toggle="dropdown" aria-expanded="false" href="#"><span class="d-none d-lg-inline mr-2 text-gray-600 small">Valerie Luna</span><img class="border rounded-circle img-profile" src="assets/img/avatars/avatar1.jpeg"/></a>
<div
class="dropdown-menu shadow dropdown-menu-right animated--grow-in" role="menu">
<a class="dropdown-item" data:role="presentation" href="#"><i class="fas fa-user fa-sm fa-fw mr-2 text-gray-400"></i> Profile</a><a class="dropdown-item" data:role="presentation" href="#"><i class="fas fa-cogs fa-sm fa-fw mr-2 text-gray-400"></i> Settings</a>
<a
class="dropdown-item" data:role="presentation" href="#"><i class="fas fa-list fa-sm fa-fw mr-2 text-gray-400"></i> Activity log</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" data:role="presentation" href="#"><i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-gray-400"></i> Logout</a>
</div>
</li>
</li>
</ul>
</div>
</nav>
}

Div is not opening below particular ngFor in Angular 6

I am iterating ngFor in angular 6. When i am clicking on button a div should open beside row of that particular button but it is opening below ngFor like this
I want to make it open for that partcular row and below that.
<app-filter></app-filter>
<div class="bg-white" *ngFor="let data of dashboardData">
<div class="container-fluid">
<div class="center-align row">
<div class="col-sm-12">
<div class="block col-sm-2">
{{data.firstname}}{{data.lastname}}
</div>
<div class="block_l col-sm-3">
<span class="light_small">68%</span>
{{data.stage}}
</div>
<div class="block_l col-sm-1">
Customer
</div>
<div class="block_l col-sm-1">
<img src="assets/images/call.png">
</div>
<div class="block_l col-sm-1">
<img src="assets/images/mail.png">
</div>
<div class="block_l col-sm-2">
<span class="status_color"><b>.</b></span>
Paused
</div>
<div class="block_l col-sm-2">
<a class="btn button_css" (click)="openLayout=!openLayout">verify Details</a>
</div>
</div>
</div>
</div>
<div class="bg-loader"></div>
<div class="container" [hidden]="openLayout">
<div class="row">
<app-form-layout></app-form-layout>
<app-form-desc></app-form-desc>
</div>
</div>
</div>
Now it is coming like this
Desired behavior will be like this It's like accordian on click it should open below that row and rest of below rows will be shifted downwards
The problem resides into openLayout variable that is shared for all your rows.
You need one openLayout for each row. you can add it dinamically to your data like this:
<div class="bg-white" *ngFor="let data of dashboardData">
<div class="container-fluid">
<div class="center-align row">
<div class="col-sm-12">
<div class="block col-sm-2">
{{data.firstname}}{{data.lastname}}
</div>
<div class="block_l col-sm-3">
<span class="light_small">68%</span>
{{data.stage}}
</div>
<div class="block_l col-sm-1">
Customer
</div>
<div class="block_l col-sm-1">
<img src="assets/images/call.png">
</div>
<div class="block_l col-sm-1">
<img src="assets/images/mail.png">
</div>
<div class="block_l col-sm-2">
<span class="status_color"><b>.</b></span>
Paused
</div>
<div class="block_l col-sm-2">
<a class="btn button_css" (click)="data.openLayout=!data.openLayout">verify Details</a>
</div>
</div>
</div>
</div>
<div class="bg-loader"></div>
<div class="container" [hidden]="data.openLayout">
<div class="row">
<app-form-layout></app-form-layout>
<app-form-desc></app-form-desc>
</div>
</div>
</div>
At the beginning it will be false because undefined is like false.

Typo3 Carousel DCE Optimize Code

I want to optimize my working carousel and I want to use for:each.
Does anyone maybe see my error?
Working Quote Code
New not working Quote Code
<div class="carousel slide" data-ride="carousel" id="quote-carousel">
<!-- Bottom Carousel Indicators -->
<ol class="carousel-indicators">
<f:for each="{field.person}" as="person" iteration=“iterator“>
<li data-target="#quote-carousel" data-slide-to="{iterator.index}" {'class="active"'->f:if(condition:iterator.isFirst)}></li>
</f:for>
</ol>
<!-- Carousel Slides / Quotes -->
<div class="carousel-inner" role="listbox">
<f:for each="{field.person}" as="person" iteration=“iterator“>
<!-- Quote {iterator.index -->
<div class="item {'active'->f:if(condition:iterator.isFirst)}">
<blockquote>
<f:format.html>{person.expert}</f:format.html>
<small>{person.expertName}</small>
</blockquote>
</div>
</f:for>
</div>
<!-- Carousel Buttons Next/Prev -->
<a data-slide="prev" href="#quote-carousel" class="left carousel-control">
<span style="top: 25%;" class="glyphicon glyphicon-chevron-left"></span>
<span class="sr-only">Previous</span>
</a>
<a data-slide="next" href="#quote-carousel" class="right carousel-control">
<span style="top: 25%;" class="glyphicon glyphicon-chevron-right"></span>
<span class="sr-only">Next</span>
</a>
</div>

Facebook Style Comment Box

I have tweets and commenting system like this
This is the code block for one set of tweet and its comments and commenting box:
<li class="storyBlock">
<div>
<div class="grid userImageBlockL">
<div class="imgMedium"> <img width="44" height="44" alt="image" src="/bakasura1/files/images/medium/1288170363aca595cabb50.jpg"> </div>
</div>
<div class="grid userContentBlockL">
<div class="userContentHeader">
<h5> Harsha Vantagudi <span class="storyMessage">Testing the Seconds</span></h5>
<span class="user-status-time">6 hours ago</span> <span>Comment Delete</span> </div>
<ul class="commentList">
<li class="commentBlock">
<div>
<div class="grid userImageBlockS">
<div class="imgSmall"> <img width="35" height="35" alt="image" src="/bakasura1/files/images/small/1288170363aca595cabb50.jpg"> </div>
</div>
<div class="grid userContentBlockS alpha omega">
<h5> Harsha Vantagudi <span class="storyMessage">Write your comment...</span></h5>
<span class="user-status-time">27 minutes ago</span> <span>Comment Delete</span></div>
<div class="clear"></div>
</div>
</li>
<li class="commentBlock">
<div>
<div class="grid userImageBlockS">
<div class="imgSmall"> <img width="35" height="35" alt="image" src="/bakasura1/files/images/small/1288170363aca595cabb50.jpg"> </div>
</div>
<div class="grid userContentBlockS alpha omega">
<form accept-charset="utf-8" action="/bakasura1/account/saveComment" method="post">
<div style="display: none;">
<input type="hidden" value="POST" name="_method">
</div>
<input type="hidden" id="StatusMessageReplyPid" value="67" name="data[StatusMessageReply][pid]">
<input type="hidden" id="StatusMessageReplyItemId" value="1" name="data[StatusMessageReply][item_id]">
<input type="hidden" id="StatusMessageReplyCommentersItemId" value="1" name="data[StatusMessageReply][commenters_item_id]">
<textarea id="StatusMessageReplyMessage" name="data[StatusMessageReply][message]">Write your comment...</textarea>
<input type="submit" name="" value="Comment">
</form>
</div>
<div class="clear"></div>
</div>
</li>
</ul>
</div>
<div class="clear"></div>
</div>
</li>
I am a little confused as to how to create an Ajax from submit when the comment is saved the new comment should stack top to bottom. Since there is no unique tweet identifier. I am not sure how to address this problem.
Can some one recommend an easy solution for the same?
http://demos.99points.info/facebook_wallpost_system/
nice demo and tutorial there
Did you try this plugin ,
http://timeago.yarp.com/
this should help