Show news from selected date using url GET parameter - typo3

How we can show the news from selected date like index.php?id=6&dateselected=13.04.2019
plugin.tx_news.settings.timeRestriction= {GP:dateselected}
plugin.tx_news.settings.timeRestrictionHigh= {GP:dateselected} +24 hour
not working but this code working
plugin.tx_news.settings.timeRestriction= 13.04.2019
plugin.tx_news.settings.timeRestrictionHigh= 13.04.2019 +24 hour

For plugin.tx_news.settings.timeRestriction= {GP:dateselected}, or something similar, you need stdWrap functionality.
Then you need: plugin.tx_news.settings.timeRestriction.insertData = 1
Or you could use plugin.tx_news.settings.timeRestriction.data
You need to activate the stdWrap for these fields:
plugin.tx_news {
settings {
useStdWrap = timeRestriction,timeRestrictionHigh
timeRestriction.data = GP:dateselected
timeRestrictionHigh = {GP:dateselected} + 24hour
timeRestrictionHigh.stdWrap.insertData = 1
}
}

Related

TYPO3 How to overwrite blog extension in custom extension

I tried this, in my extension's setup.typoscript. but is not work for me.
plugin.tx_blog {
view {
layoutRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
}
all the "RootPaths" are arrays so change it to somting like this
plugin.tx_blog {
view {
layoutRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Layouts/
partialRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Partials/
templateRootPaths.200 = EXT:solution/Resources/Private/Extensions/Blog/Templates/
}
the "200" in the examle is the position if Fluid is looking for a Resource (like a template) it will check every provided path in numerical order.
use the Typoscript Object Browser (in the Template Module) to check the configured RootPaths
The standard setup of that extension is a bit uncommon.
The easiest was to override the paths for fluid files is to use the constant editor. There you have fields where you can enter your own paths.
If you want to do it in the setup, you can look in the TypoScript setup of the extension that looks like shown below.
page = PAGE
page {
typeNum = 0
10 = FLUIDTEMPLATE
10 {
templateName = BlogList
templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
...
So in a short block the the paths would look like this:
page.10.templateRootPaths {
0 = EXT:blog/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
page.10.partialRootPaths {
0 = EXT:blog/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
page.10.layoutRootPaths {
0 = EXT:blog/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
In the lines starting with 1 you can enter your own path if you never want to use the constants. For this you never have to enter it in the original TypoScript template, but just copy the block above in your own TypoScript and adjust the paths. If your TypoScript is loaded after that of the blog, it's overwriting the original values.
Take care that there exist different setups, one in each folder inside https://github.com/TYPO3GmbH/blog/tree/master/Configuration/TypoScript. So depending on the template you chose the setup must be different. But I hope you're able to adapt the way to go now.

TYPO3 News Sitemap Configuration - actual date in additionalWhere statement

TYPO3 V10 with seo and news extension:
In my news sitemap I only want to show news that are not archived. The following configuration works, but I need to replace the fixed value for the timestamp with a dynamic one:
plugin.tx_seo.config {
xmlSitemap {
sitemaps {
news {
provider = TYPO3\CMS\Seo\XmlSitemap\RecordsXmlSitemapDataProvider
config {
table = tx_news_domain_model_news
additionalWhere = AND archive = 0 OR archive > 1640800495
How can I do this?
I know how to build the statement as a text object in TypoScript, but how can I use it behind additonalWhere:
lib.statement = TEXT
lib.statement.value = AND archive = 0 OR archive > {date : U}
lib.statement.value.insertData = 1
I know how to use a constant, but I think I can't make it dynamic:
additionalWhere = {$constant.statement}
I also tried to use a REGISTER, but without success.
additionalWhere = AND archive = 0 OR archive > {REGISTER:statement}
additionalWhere.insertData = 1
I think, using a SQL Function directly is the best solution here (thanks to Julian Hofmann):
additionalWhere = start_date > CURDATE()
or
additionalWhere = archive = 0 OR archive > UNIX_TIMESTAMP()

TYPO3 : SimplePoll : show the last

currently I'm using simplepoll.uid to show a Poll on the Frontend :
lib.poll = USER
lib.poll {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = Simplepoll
pluginName = Polllisting
vendorName = Pixelink
settings =< plugin.tx_simplepoll.settings
settings {
simplepoll.uid = 13 // this is the ID of the Poll to show
}
persistence =< plugin.tx_news.persistence
view =< plugin.tx_news.view
}
is there a way to show automatically the last poll added to the storagePid instead of simplepoll.uid ?
It could be that my solution does not work as there might be no stdWrap support in the extension. Then you should ask the extension author to build in the wrapping (or support him with a pull request).
Requesting the uid from the last created poll should be possible with an SQL query which selects the highest uid.
An SQL query can be done in typoscript with the CONTENT object:
lib.poll {
settings {
simplepoll.uid.cObject = CONTENT
simplepoll.uid.cObject {
table = tx_poll... // get the exact page name
select {
selectFields = uid
pidInList = ??? // insert storage page of your polls
orderBy = uid DESC
max = 1
}
renderObj = TEXT
renderObj. field = uid
}
}
}
You need no WHERE clause to select no deleted and hidden records as these where inserted automatically.
Be aware to create polls in hidden mode otherwise an incomplete poll could be selected.
testing with
<f:cObject typoscriptObjectPath="lib.poll.settings.simplepoll.uid.cObject" />
or
page.1 < lib.poll.settings.simplepoll.uid.cObject
page.1.wrap = <h1>poll = [|]</h1>

Check field on parent page in TMENU?

In a TMENU, can I check the value of a field on the parent page?
I want to do something like this:
lib.mymenu = HMENU
lib.mymenu {
entryLevel=0
1 = TMENU
1 {
...
}
2 < .1
2 {
NO {
stdWrap.wrap {
if.equals.field = parent:myfield
if.value = 1
cObject < lib.specialmenu
}
}
}
}
Does the parent mean the item of the first level in this case? Or in other words: a field in the record which UID is the PID of the current item?
Then, there's a (german) blogpost on how to get dynamically fields via stdWrap:
https://blog.marit.ag/2009/12/15/datenbankfelder-stdwrap-data/
guess you have to implement a custom menuprocessor, or try at least a fluid version of your menu. in plain typoscript i dont know a solution for this.
this link may help you for my suggestion: https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/MainMenuCreation/Index.html

How to communicate two plugins of News for Typoscript

I have to show in my single page: the single and the list of News with the same categories of single new. I have two plugins in my backend page and have tried to assign the categories of single to the list for typoscript, but i could not do it.
This is the code, i used page.x for debug and catch values:
page.100 = TEXT
page.100.data = GP:tx_ttnews|tt_news
page.100.wrap = The single tt_news id is: |
page.100.data = GP:tx_ttnews|cat
page.100.wrap = The category of single is: |
page.110 = TEXT
page.110
{
value = { register:newsCategoryUid }
insertData = 1
wrap = - Categories: |
}
plugin.tt_news
{
categorySelection = { register:newsCategoryUid }
#show only selected categories
categoryMode = 1
}
It's not fully visible what you're trying. I think the best way should to put the cat value inside a temp object. Do you have the plugins inserted by TypoScript or as Content Element? You are using tt_news not news by georg ringer right?
temp.tx_news_catId = TEXT
temp.tx_news_catId.data = GP:tx_ttnews|cat
temp.tx_news_catId.intval = 1
page.110 < temp.tx_news_catId
page.110.wrap = Category: |
plugin.tt_news
{
categorySelection < temp.tx_news_catId
# you need to use data not categorySelection = {...} <- that should
# only work on constants
# but only works if categorySelection capabilities
#categorySelection.data = register:newsCategoryUid
#show only selected categories
categoryMode = 1
}
(Untested TypoScript)
hope this helps you a little bit
PS: Have you checked whether categorySelection has stdWrap capabilities?
I don't really get what you want to do, maybe this helps a bit:
If you want to show in the detail action articles with the same category as the current one, you can use a snippet like this one:
Add this to the Detail.html which will pass the first category uid to the TypoScript object lib.tx_news.relatedByFirstCategory.
<f:if condition="{newsItem.firstCategory}">
<f:cObject typoscriptObjectPath="lib.tx_news.relatedByFirstCategory">{newsItem.firstCategory.uid}</f:cObject>
</f:if>
and the TS:
lib.tx_news.relatedByFirstCategory = USER
lib.tx_news.relatedByFirstCategory {
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
extensionName = News
pluginName = Pi1
vendorName = GeorgRinger
switchableControllerActions {
News {
1 = list
}
}
settings < plugin.tx_news.settings
settings {
relatedView = 1
detailPid = 31
useStdWrap := addToList(categories)
categories.current = 1
categoryConjunction = or
overrideFlexformSettingsIfEmpty := addToList(detailPid)
startingpoint = 78
}
}
I have taken this from the manual.