TYPO3 top 3 or 5 news from tx_news - typo3

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.

Related

TYPO3 tx_news entries within a date range

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

How force a template file in tt_news LIST?

I have a list in tt_news and use many folders with tt_news records. I want to use a different template in this list when I filter and display specific category.
My Typoscript is:
[globalVar = GP:tx_ttnews|place|0 = 79]
#Display list of specific category
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/different.html
[else]
#General display list
plugin.tt_news.templateFile = fileadmin/templates/plugins/tt_news/general.html
[end]
I have used plugin.tt_news.templateFile and plugin.tt_news.file.templateFile but don't work. I am using the last version of tt_news and TYPO3 6.2
"plugin.tt_news.templateFile" is right, i think there is a problem in "[globalVar = GP:tx_ttnews|place|0 = 79]" you should close global with "[global]" instead of "[end]". Try this if it is helpful to you.
For the Typoscript way did not resolve this, I do not why? For we needed we have use a category and marker in the template of tt_news and create a logic in frontend through JS for resolve this.

TYPO3 onepager + normal pages structure

I am very new to TYPO3 and I am having problems achieving the following:
A website structure looking like so
-home
— Sub content 1
— Sub content 2
— Sub content 3
— etc..
-page 1
-page 2
-etc…
The home page should be collecting the “sub content 1” “sub content 2” & "sub content3", so it should behave like a one pager.
And the other pages should be behaving as ‘normal’ pages.
I downloaded the FluidTypo3 kickstarter package. And followed then this tutorial: https://worksonmymachine.org/blog/onepage-design-with-fluidtypo3 where it is described how to achieve a onepager with FluidTypo3.
I managed so far to get this result:
-root
—Sub content 1
—Sub content 2
—Sub content 3
As soon as I add a new level:
-root
—home
—— sub content 1
—— sub content 2
The Onepager effect stops functioning, and the sub pages are not being collected anymore. I did configure under “Edit page” which template should be used, yet no success.
I am stuck to this step and can’t figure out why this is not functioning? Ideas?
I have Typo3 6.2 installed.
The problem is simple:
You have added one level to your menu so your old page structure not correct anymore. You use a
v:page.menu
And it should have the correct access point to you page structure.
If you check the specification of this ViewHelper, you find the
entryLevel
However the specification says only:
Optional entryLevel TS equivalent of the menu (integer)
You need to search a bit more to understand its working, and if you see the TypoScript documentation for HMENU then you see how it works:
Defines at which level in the rootLine the menu should start.
Default is "0" which gives us a menu of the very first pages on the
site.
If the value is < 0, entryLevel is chosen from "behind" in the
rootLine. Thus "-1" is a menu with items from the outermost level,
"-2" is the level before the outermost...
(You got already the help in the comments, but I wanted to write here an answer based on the feedbacks)

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)