TYPO3 News Extension, issue with tx_news.templateLayouts - typo3

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.

Related

Typo3 tx_news TagList Filter based on selecting two different Category Menu on Same Page?

Hi all I am having an Issue Lets Suppose I am having a news Tag record and news record with two different Category Menu as describe below
In List View i selected C1 (show all Videos with Selected Category OR)
V1(Vedio)-C1(Category)-T1(Tag), V2-C1-T2, V3-C1-T1, V4-C1,T2 in same way V5-C2-T1, V6-C2-T2, V7-C2-T1, V8-C2-T2.Issue is when i choose C1 menu then T1 OR T2 Its fine..Showing V1,V3 or V2,V4...but when i choose C2 menu then T1 or T2 ,its giving the same Content V1,V3 or V2,V4.
for correct logic filter it should give..V5,V7 orV6,V8..becuase I selected C2 menu.
I am having two files which i think I have to correct but i don't know how to do this?
1.C:\xampp\htdocs\mysite\typo3conf\ext\news\Resources\Private\Templates\Styles\Twb\Templates\Category\List.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<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,class:'nav nav-sidebar category-menu-view'}" />
</f:then>
<f:else>
<f:translate key="list_nocategoriesfound" />
</f:else>
</f:if>
</f:section>
<f:section name="categoryTree">
<ul class="{class}">
<f:for each="{categories}" as="category">
<li>
<f:if condition="{category.item.uid} == {overwriteDemand.categories}">
<f:then>
<f:link.page title="{category.item.title}" 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 title="{category.item.title}" 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,class:''}" />
</f:if>
</li>
</f:for>
</ul>
</f:section>
</html>
enter image description here2.C:\xampp\htdocs\mysite\typo3conf\ext\news\Resources\Private\Templates\Styles\Twb\Templates\Tag\List.html
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="General" />
<!--
=====================
Templates/Tag/List.html
-->
<f:section name="content">
<f:if condition="{tags}">
<ul class="nav nav-sidebar tag-menu-view">
<f:for each="{tags}" as="tag">
<li class="{f:if(condition:'{tag.uid} == {overwriteDemand.tags}',then:'active',else:'')}">
<f:link.page title="{tag.title}" pageUid="{settings.listPid}" additionalParams="{tx_news_pi1:{overwriteDemand:{tags: tag}}}">
{tag.title}
</f:link.page>
</li>
</f:for>
</ul>
</f:if>
</f:section>
</html>
Sorry but I don't really understand what you want to achieve. However it seems that the best solution would be to write a custom extension which generates the views you need, based on EXT:news. This is described in the manual here https://docs.typo3.org/typo3cms/drafts/github/georgringer/news/DeveloperManual/ExtendNews/ExtensionBasedOnNews/Index.html

TYPO3 news - defining own template

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).

Tx_news detail view skip first picture

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 ?

How to wrap newsItem in tx_news?

I use Typo3 6.1. And the Newsextension news (tx_news).
It's work fine - but I have a problem.
I want to wrap a NewsItem with a "Header" and a "Footer", but I don't find a solution.
Here is my Fluid Template:
<f:section name="content">
<f:if condition="{news}">
<f:then>
<f:for each="{news}" as="newsItem" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<f:render partial="List/ItemNewsHeader" arguments="{newsItem: newsItem, settings:settings}" />
</f:if>
<f:if condition="{newsItem.istopnews = FALSE}">
<f:then>
<f:render partial="List/ItemNews" arguments="{newsItem: newsItem, settings:settings}" />
</f:then>
</f:if>
<f:if condition="{iterator.isLast}">
<f:render partial="List/ItemNewsFooter" arguments="{newsItem: newsItem, settings:settings}" />
</f:if>
</f:for>
</f:then>
</f:if>
</f:section>
I try here to wrap all NewsItems with the ItemNewsHeader and the ItemNewsHeader, but it will be print out by every NewsItem and I don't know why.
Ok - i have it.
It's easy. Here my new example for "newsItems". All Items will be wrap with the specific partial. On this example - all "normal news", without topnews.
<f:if condition="{newsItem.istopnews}">
<f:then>
</f:then>
<f:else>
<f:if condition="{iterator.isFirst}">
<f:render partial="List/ItemPressHeader" arguments="{newsItem: newsItem, settings:settings}" />
</f:if>
<f:render partial="List/ItemPress" arguments="{newsItem: newsItem, settings:settings}" />
<f:if condition="{iterator.isLast}">
<f:render partial="List/ItemPressFooter" arguments="{newsItem: newsItem, settings:settings}" />
</f:if>
</f:else>
</f:if>

TYPO3 tx_news category layout

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>