TYPO3 tx_news entries within a date range - typo3

I am currently migrating tt_news to news. The old news system also has news-entries shown as events. Is it somehow possible to hide entries that are past, without having to archive those? Or else to show only entries within the next x days?
This was possible with tt_news typoscript:
extensions.ttnews_selectconf {
andWhere (
tt_news.datetime < (UNIX_TIMESTAMP() +604800)
AND tt_news.datetime > (UNIX_TIMESTAMP()-86400)
)
}
I could not find anything in the news docs.

The news extension has a TypoScript option to set a minimum date/time: https://docs.typo3.org/typo3cms/extensions/news/stable/AdministratorManual/Configuration/TypoScript/Index.html#timerestriction
So plugin.tx_news.settings.timeRestriction = now will show news items starting now. plugin.tx_news.settings.timeRestriction = today will show news items starting at the start of today.
For a maximum date you can use timeRestrictionHigh
Also, if you're using news for events, you might want to check out the eventnews extension. This extends the news extension to add fields and views that are useful for events. https://extensions.typo3.org/extension/eventnews

Related

Import from tt_news with additional fields in tt_news and news (TYPO3 8 LTS)

import from tt_news in TYPO3 8 LTS with actual news and news_ttnewsimport is working fine. But we had some individual fields in tt_news and i want to import theese fields too in individuel fields in news.
So i made a new extension which extends news with individual fields. It is working fine: i can edit them in the backend and print content in the frontend.
Then i modified getImportData() in TTNewsNewsDataProviderService of news_ttnewsimport and added my new fields. The content of the individual fields of tt_news is fetched, i controlled it with a log-file. But the content was not written in the database ... I controlled the getter and setter in my configuration of news but all seems correct.
After some debugging i found that all commands which write the content in news are hardcoded in news/Classes/Domain/Service/NewsImportService.php:
$news->setAuthor($importItem['author']);
After adding my fields all works:
$news->setMyNewField($importItem['my_new_field']);
So my problem is fixed ... well some how: it seems dirty to change a class of an extension in order to handle individual fields.
Is there a correct possibility to make the import work with individual fields, without patching news?
Thanks!
In version 7 of tx_news i found the answer of my question ... i don't know wether it exists in older versions but in 7.1 it is possible to use a signal slot for this task:
link to the manual: Prehydrate slot

TYPO3 top 3 or 5 news from tx_news

I have search google for "top 3"/"top 5" and latest news, about the extension TX_News and i can't find any guides how to show a custom top 3 or 5 news, with typoscript inside a lib.
If u look at the bottom of www.codem.dk I want to show the latest 3 or 5 news in the middle of the footer "Seneste indlæg", but I can't find a tutorial showing or guide, how to do this.
Do someone have some info how to do this ?
Im running TYPO3 v. 6.1 with FLUID/EXTBASE.
The easiest way would be to set up a plugin on a hidden page/maybe a folder and set all the options in the FlexForm:
- limit to 3 news
- sort by given date descending
- maybe only show top news if you're using this feature
Then you just use the RECORD cObject to assign your plugin to a lib:
lib.latestNews = RECORDS
lib.latestNews.source = [content uid]
lib.latestNews.dontCheckPid = 1
lib.latestNews.tables = tt_content
What do you mean with "top 3" news? how do you get to this order? If this is a custom field in the tx_news_domain_model table, you can of course use this for the ordering and set a limit to 3 or 5.

TYPO3 news (tx_news) ordering of records not working

I'm running TYPO3 V6 and the latest version of tx_news (not tt_news) and when I attempt to change the order of sorting for the LIST display, the settings in the plugin are not overriding the Typoscript settings. There doesn't seem to be a way to change to sort order of articles in the list view. I am aware that flagging a news record as "top news" will float it to the top of the list, but none of my records have that flag set.
Has anyone else had this problem?
I got the same problem: My listview always showed the oldest news on the top. I've been searching for a solution for hours. As i wanted to start to change the extension files manually, I found the "setup.txt" in the configuration folder. From there I copied the following code into my Typoscript. The problem is solved now.
plugin.tx_news{
settings{
overrideFlexformSettingsIfEmpty = cropMaxCharacters,dateField,timeRestriction,orderBy,orderDirection,backPid,listPid,startingpoint,recursive
orderBy = datetime
orderDirection = desc
orderByRespectTopNews = 0
orderByAllowed = sorting,author,uid,title,teaser,author,tstamp,crdate,datetime,categories.title
list{
paginate {
itemsPerPage=4
insertBelow=TRUE
lessPages=TRUE
#forcedNumberOfLinks=3
pagesBefore=1
pagesAfter=1
}
}
}
}
You can ignore the pagination lines. Important is the orderby stuff.
Typo3 Version: 4.7 (not my fault :D )
News System Version: 2.3
Found the solution to this one - basically I had been loading the TS setup code from an external file, which was overriding the default TS setup from the Typoscript template setup field, or rather, it wasn't. I duplicated the TS code in the Typoscript template and the external file and finally it is being recognised and the fields can be sorted.

TT_NEWS Force Display of Latest News in Single/Latest implementatin (TYPO3)

Sirs,
I have a nice working implementation of SINGLE and Latest on same page. My realurl is working perfectly. Problem is, by default, single doesn't show anything until you click on one of the listed news (displayed by the list plugin). I would like the single plugin to show the latest news on landing.
Any ideas?
FIRST SOLUTION
The solution for the requested behavior is described in the tt_news manual:
Default news id
Insert the following lines to the setup field of an ext-template at
the page where you want to display the latest news item in SINGLE view
if no SINGLE view for another record was requested:
# hide the "no news id" message
plugin.tt_news._LOCAL_LANG.default.noNewsIdMsg =
# set the tt_news singlePid to the current page
plugin.tt_news.singlePid = 977
# fill the content of the main-column to a tmp.object
tmp.pagecontent < page.10.subparts.contentarea
# clear the content of the main column
page.10.subparts.contentarea >
# build a new object for this column as content-object-array
page.10.subparts.contentarea = COA
page.10.subparts.contentarea {
10 = CONTENT
10.table = tt_news
10.select {
# insert the pids of all pages from where you want to fetch news.
# the recursive-field has no influence on this selection
pidInList = 1078,1079,1080,1081,1082,1083,1084
orderBy = datetime desc
max = 1
}
# insert the object “10.” only if there is no SINGLE news selected
# ATTENTION, OUTDATED IN MANUAL, USE GP:... instead of GPvar:... !!!
#10.stdWrap.if.isFalse.data = GPvar:tx_ttnews|tt_news
10.stdWrap.if.isFalse.data = GP:tx_ttnews|tt_news
# re-insert the normal pagecontent to the page
20 < tmp.pagecontent
}
The page in this example contains 2 columns. The news LIST is located
in the left column. the main column (page.10.subparts.contentarea)
contains a SINGLE news content-element.
SECOND SOLUTION – MY FAVORITE
My personal favorite to solve the problem is a bit more slick. It makes use of the noNewsIdMsg (which is simply emptied in the above solution) and uses its stdWrap version to show the latest record exactly when there would normally be a "No news ID" message.
# use the "no news id" message position for the latest news record
plugin.tt_news.singlePid = 977
plugin.tt_news.noNewsIdMsg_stdWrap.cObject = COA
plugin.tt_news.noNewsIdMsg_stdWrap.cObject {
10 = CONTENT
10.table = tt_news
10.select {
# insert the pids of all pages from where you want to fetch news.
# the recursive-field has no influence on this selection
pidInList = 1078,1079,1080,1081,1082,1083,1084
orderBy = datetime desc
max = 1
}
}
Please be aware that in BOTH solutions the template subpart that is used for the inserted default record is NOT ###TEMPLATE_SINGLE### but ###TEMPLATE_SINGLE_RECORDINSERT###.
One solution is to change the text limit for latest view in that particular news plugin as given below:
plugin.tt_news.displayLatest.subheader_stdWrap.crop = 10000 | ... | 1
and also provide a separate template file without
<!--###LINK_ITEM###-->
markers in latest view section.
The Safe Single News extension
adds a new tt_news code: SAFE_SINGLE which ensures that a single news
article is shown even if none is specified. If a news article is
selected, it will simply show it. If none is selected, it will display
the latest news article for the configured category.
Maybe it could help you.
Why not have a "single/latest" view showing a single view (if submitted) and latest if no single view requested. In this plugin set news-limit for latest to "1".
Below add another latest (or list) with news limit set to 3 (or as wanted)

Can I filter TT_NEWS in Typo3 by a date range?

I'm building a Typo3 website with the TT_NEWS extension; now I want to create a TT_NEWS list/latest view with a certain date range, but I cant find a way to do so.
I can't use the ARCHIVE function because I need a specific data range.
I hope that one of you knows the magic answer :-)
You can try setting an exact date range for the archive with TypoScript:
plugin.tt_news.amenuStart = 1.2.2003
plugin.tt_news.amenuEnd = 4.5.2006
This is assuming you only need one date range. For more than one range, maybe news categories would do the trick, but you'd need to assign them manually.
For tx_news use this in TypoScript:
1.settings.timeRestriction = 01.02.2003
1.settings.timeRestrictionHigh = 04.05.2006