I use the VHS ViewHelper "v:page.menu.browse". So I can click through pages that are on the same level. This also works just fine. However, what is not working, that I get the navigation elements appear only if more than one page is available. I've already tried with f:count query whether more than one page is available. Unfortunately, he shows me the items still on. Does somebody has any ideas?
<v:page.menu.browse>
<f:if condition="<f:count>{menu.prev}</f:count> > 1">
<f:then>
<li><span class="icondetail-icon_prev"></span>1</li>
</f:then>
<f:else>
<f:if condition="<f:count>{menu.prev}</f:count> > 1">
<f:then>
<li><span class="icondetail-icon_prev"></span>2</li>
</f:then>
<f:else>
</f:else>
</f:if>
</f:else>
</f:if>
<li><span class="icondetail-icon_uebersicht"></span></li>
<li><span class="icondetail-icon_mail"></span></li>
<f:if condition="<f:count>{menu.next}</f:count> > 1">
<f:then>
<li><span class="icondetail-icon_next"></span>3</li>
</f:then>
<f:else>
<f:if condition="<f:count>{menu.next}</f:count> > 1">
<f:then>
<li><span class="icondetail-icon_next"></span>4</li>
</f:then>
<f:else>
</f:else>
</f:if>
</f:else>
</f:if>
</v:page.menu.browse>
You can't use tag notation within the attributes, like you have here:
<f:if condition="<f:count>{menu.prev}</f:count> > 1">
Instead you should use inline notation:
<f:if condition="{menu.prev -> f:count()} > 1">
or
<f:if condition="{f:count(subject: menu.prev)} > 1">
This is my solution
<v:page.menu.browse>
<f:if condition="<f:count>{menu}</f:count> == 3">
<f:then>
<li><span class="icondetail-icon_uebersicht"></span></li>
<li><span class="icondetail-icon_mail"></span></li>
</f:then>
<f:else>
<f:if condition="{menu.prev.link}">
<f:then>
<li><span class="icondetail-icon_prev"></span></li>
<li><span class="icondetail-icon_uebersicht"></span></li>
</f:then>
<f:else>
<li><span class="icondetail-icon_prev"></span></li>
<li><span class="icondetail-icon_uebersicht"></span></li>
</f:else>
</f:if>
<f:if condition="{menu.next.link}">
<f:then>
<li><span class="icondetail-icon_mail"></span></li>
<li><span class="icondetail-icon_next"></span></li>
</f:then>
<f:else>
<li><span class="icondetail-icon_mail"></span></li>
<li><span class="icondetail-icon_next"></span></li>
</f:else>
</f:if>
</f:else>
</f:if>
</v:page.menu.browse>
Related
I have a problem with inserting to eventnews list view data from tx-news extension - for example: category title. I have tried with this code but it didn't works:
<f:if condition="{newsItem.categories}">
<f:for each="{categories}" as="category">
<f:if condition="{category.shortcut}">
<f:then>
<f:link.page pageUid="{category.shortcut}">
{category.title}
</f:link.page>
</f:then>
<f:else>
<span>{category.title}</span>
</f:else>
</f:if>
</f:for>
</f:if>
Any suggestions how to display this data?
The whole list view template looks like that:
<f:section name="listItem">
<div class="col-md-12" style="border: 1px solid #ccc;">
<strong>
<n:link newsItem="{n}" settings="{settings}">{n.title}</n:link>
| {f:format.date(date:n.datetime.date,format:'%d.%m')}</strong>
<ul>
<f:if condition="{n.organizer}">
<li><strong>
<f:translate key="organizer" extensionName="eventnews" />
</strong>: {n.organizer.title}
<small>(uid: {n.organizer.uid})</small>
</li>
</f:if>
<f:if condition="{n.location}">
<li><strong>
<f:translate key="location" extensionName="eventnews" />
</strong>: {n.location.title}
<small>(uid: {n.location.uid})</small>
</li>
</f:if>
<f:if condition="{n.eventEnd}">
<li>
<strong>
<f:translate key="event_end" extensionName="eventnews" />
</strong>: {f:format.date(date:n.eventEnd.date,format:'%d.%m.%Y')}
</li>
</f:if>
</ul>
</div>
</f:section>
I'm using TYPO3 7.6.14 with the news extension. I want to switch between different views in the backend.
Page TS in root:
tx_news.templateLayouts {
Custom = Gesamter Artikel2
}
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
xmlns:n="http://typo3.org/ns/GeorgRinger/News/ViewHelpers"
data-namespace-typo3-fluid="true">
<f:layout name="General" />
<!--
=====================
Templates/News/List.html
-->
<f:section name="content">
<!--TYPO3SEARCH_end-->
<f:if condition="{news}">
<f:then>
<div class="news-list-view">
<f:if condition="{settings.hidePagination}">
<f:then>
<f:for each="{news}" as="newsItem">
<f:if condition="{0:settings.templateLayout} == {0:'Custom}">
<f:then>
<f:render partial="List/GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</f:then>
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}" />
</f:for>
</n:widget.paginate>
</f:else>
</f:if>
</div>
</f:then>
<f:else>
<div class="no-news-found">
<f:translate key="list_nonewsfound" />
</div>
</f:else>
</f:if>
<!--TYPO3SEARCH_begin-->
</f:section>
</html>
In the same folder where I have my List.html I've added my own file named GesamteArtikel.html
What am I doing wrong?
EDIT:
(Changed location of file)
I figured out that it has no impact. I changed it to something like:
<f:then>
<f:for each="{news}" as="newsItem">
<f:if condition="{settings.templateLayout} == 'Custom'">
<f:then>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</f:then>
And it did nothing.
It uses
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:render partial="List/Item" arguments="{newsItem: newsItem,settings:settings,iterator:iterator}" />
</f:for>
</n:widget.paginate>
</f:else>
I then changed it to
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}" initial="{offset:settings.offset,limit:settings.limit}">
<f:for each="{paginatedNews}" as="newsItem" iteration="iterator">
<f:if condition="{settings.templateLayout} == 'Layout'">
<f:then>
<f:render partial="GesamteArtikel" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:then>
<f:else>
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings, className:className, view:'list'}"/>
</f:else>
</f:if>
</f:for>
</n:widget.paginate>
</f:else>
But it then uses the Item.html only
If I tell both if statements to use GesamteArtikel (custom template) it will use it, but I don't want to override the old item.html. I want to use my custom layout when I select it in the backend...
Two things might help:
Firstly it looks like you‘re missing a single quote in your comparison:
<f:if condition="{0:settings.templateLayout} == {0:'Custom}">
and you can do string comparisons without array bypass, so what you get is:
<f:if condition="{settings.templateLayout} == 'Custom'">
The second thing is the location of the file for your custom layout:
In the same folder where I have my List.html I've added my own file named GesamteArtikel.html
You need to put it somewhere in your partial root paths, like EXT:my_ext/Resources/Private/Partials/List/ sibling of the partial List/Item (in case you override that one).
I want to render a news item from the News extension, but in the detail view I want to render all images except the first image. I have tried this, seek a solution through a iteration, but somewhere is still a fault has occurred.
The code is:
{namespace n=GeorgRinger\News\ViewHelpers}
<f:for each="{media}" as="mediaElement" iteration="iter">
<f:if condition="{iter.index}" >1>
<div class="mediaelement mediaelement-image">
<f:if condition="{mediaElement.link}">
<f:then>
<f:link.page pageUid="{mediaElement.link}" target="{n:targetLink(link:mediaElement.link)}">
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</f:link.page>
</f:then>
<f:else>
<f:if condition="{settings.detail.media.image.lightbox.enabled}">
<f:then>
<a href="{f:uri.image(image:'{mediaElement}', width:'{settings.detail.media.image.lightbox.width}', height:'{settings.detail.media.image.lightbox.height}')}" title="{mediaElement.title}" class="{settings.detail.media.image.lightbox.class}" rel="{settings.detail.media.image.lightbox.rel}">
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</a>
</f:then>
<f:else>
<f:image image="{mediaElement}" title="{mediaElement.title}" alt="{mediaElement.alternative}" maxWidth="{settings.detail.media.image.maxWidth}" maxHeight="{settings.detail.media.image.maxHeight}" />
</f:else>
</f:if>
</f:else>
</f:if>
</div>
<f:if condition="{mediaElement.description}">
<p class="news-img-caption">
{mediaElement.description}
</p>
</f:if>
</f:if>
</f:else>
Perhaps someone is able to help?
You have a syntax error in your f:if:
<f:if condition="{iter.index}" >1>
Should be:
<f:if condition="{iter.index} > 1">
(quote misplaced - whitespace after the > is just for prettiness.
Sorry , I have worked in the wrong Partial . Not the FalMediaImage need to be adjusted but the FalMediaContainer .
<f:if condition="{media}">
<!-- fal media files -->
<div class="news-img-wrap">
<f:for each="{media}" as="mediaElement" iteration="iter">
<f:if condition="{iter.index} >0">
<div class="outer">
<f:if condition="{mediaElement.originalResource.type} == 2">
<f:render partial="Detail/FalMediaImage" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
<f:if condition="{mediaElement.originalResource.type} == 4">
<f:render partial="Detail/FalMediaVideo" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
<f:if condition="{mediaElement.originalResource.type} == 5">
<f:render partial="Detail/FalMediaImage" arguments="{mediaElement: mediaElement, settings:settings}"/>
</f:if>
</div>
</f:if>
</f:for>
</div>
</f:if>
Maybe it will help someone else who has the same problem as me ?
I have made a top3 view of the news list. (se bottom) www.codem.dk, i have a problem, and thats that it using my default list.html layout.
I have tried this, but i can't get it to work.
I have Templates/News/List.html and here i have this code. where I have the condition about the templateLayout = 99 and where i tell it to use Partials/List/ItemTop.html
{namespace n=Tx_News_ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/News/List.html
-->
<f:section name="content">
<f:if condition="{news}">
<f:then>
<f:if condition="{settings.templateLayout} == 99">
<f:then>
<ul>
<f:for each="{news}" as="newsItem">
<f:render partial="List/ItemTop" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</ul>
</f:then>
<f:else>
<f:if condition="{settings.hidePagination}">
<f:then>
<f:for each="{news}" as="newsItem">
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</f:then>
<f:else>
<n:widget.paginate objects="{news}" as="paginatedNews" configuration="{settings.list.paginate}">
<div class="news-list-view">
<ul class="cbp_tmtimeline {newsItem.type}{f:if(condition: newsItem.istopnews, then: ' topnews')}">
<f:for each="{paginatedNews}" as="newsItem">
<f:render partial="List/Item" arguments="{newsItem: newsItem, settings:settings}" />
</f:for>
</ul>
</div>
</n:widget.paginate>
</f:else>
</f:if>
</f:else>
</f:if>
</f:then>
<f:else>
<div class="no-news-found">
<f:translate key="list_nonewsfound" />
</div>
</f:else>
</f:if>
</f:section>
Then i have the Partials/List/ItemTop.html page, that have this code.
{namespace n=Tx_News_ViewHelpers}
<n:excludeDisplayedNews newsItem="{newsItem}" />
<li>
<n:link newsItem="{newsItem}" settings="{settings}">
{newsItem.title}
</n:link>
<span class="post-date"><n:format.date format="{f:translate(key:'dateFormat')}">{newsItem.datetime}</n:format.date></span>
</li>
Then I have this in my Page TS config code, on the hidden SYS folder, thats show the top3 news.
tx_news.templateLayouts {
99 = Top 3 News layout
}
But i can see it's still using the layout code from the default Partials/List/Item.html page, whats wrong here ?
As a first step, just let a template output
{settings.templateLayout}
to see if it is really 99. I guess it is not. Did you only set the possibility to have a layout 99 in PageTS? Maybe you forgot to select this layout in the News Plugin.
I'm running TYPO3 v. 6.1 with FLUID/EXTBASE.
I have installed the EXT News System (news) and it's working fine.
I have added Archive and the CATMENU, but I have some issue with the Categories list (Kategori) and it's bc of "category.item.uid" and "category.children" how do I edit the layout so I get a line between every link, like if u look at the last link "Generelt"
I have the two lines as I wan't, bc. there is no sub-link for that category.
And how can I add a ( x ) after the category that shows the value of news in the category.
http://codem.dk/blog/
I have this code in the category list.html
{namespace n=Tx_News_ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/Category/List.html
-->
<f:section name="content">
<f:if condition="{categories}">
<f:then>
<f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
</f:then>
<f:else>
<f:translate key="list_nocategoriesfound" />
</f:else>
</f:if>
</f:section>
<f:section name="categoryTree">
<div id="categories-2" class="widget widget_meta widget_categories">
<ul>
<f:for each="{categories}" as="category">
<li class="cat-item">
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>
<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</ul>
</div>
</f:section>
Don't know if there is a better way, but I removed the div and ul from the categoryTree section and added em to the content section.
That fixed the problem.
{namespace n=Tx_News_ViewHelpers}
<f:layout name="General" />
<!--
=====================
Templates/Category/List.html
-->
<f:section name="content">
<div id="categories-2" class="widget widget_meta widget_categories">
<ul>
<f:if condition="{categories}">
<f:then>
<f:render section="categoryTree" arguments="{categories:categories,overwriteDemand:overwriteDemand}" />
</f:then>
<f:else>
<f:translate key="list_nocategoriesfound" />
</f:else>
</f:if>
</ul>
</div>
</f:section>
<f:section name="categoryTree">
<f:for each="{categories}" as="category">
<li class="cat-item">
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page class="active" pageUid="{settings.listPid}"
additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:then>
<f:else>
<f:link.page pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{categories: category.item.uid}}}">{category.item.title}
</f:link.page>
</f:else>
</f:if>
<f:if condition="{category.children}">
<f:render section="categoryTree" arguments="{categories: category.children,overwriteDemand:overwriteDemand}" />
</f:if>
</li>
</f:for>
</f:section>