TYPO3 News Sitemap Configuration - actual date in additionalWhere statement - typo3

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

Related

Typo3 10.4.4 Gridelements 10.0.0 extension not working

Hey I am pretty new to typo3 and I want to build a website.
I am running version 10.4.4 of TYPO3 with the bootstrap package installed.
I have tried to follow the guide on https://docs.typo3.org/typo3cms/extensions/gridelements/stable/
I have copied the TypoScript into my template setup, but there is no output on the frontend.
Remember I am new to this so I don't understand the TypoScript well yet.
So any ideas to what I could do?
EDIT:
I want to use GriElements so that I can create my own layouts on my page. The standard layouts are good but I need more freedom than what they offer.
I can get output on the frontend without GridElements, but when I use the extension only the content in the GridElements block wont show. If I remove the standard TypoScript from the example on the manual page for this extension i get an error saying "Oops an error occurred! Code:" and then a code that changes every time I update the page.
My TypoScript on my template looks like this:
page.includeCSS.1 = fileadmin/user_upload/template/css/fonts.css
page.includeCSS.theme = fileadmin/user_upload/template/css/custom-theme.scss
# plugin.tx_bootstrappackage._LOCAL_LANG.da.readmore = test (NOT WORKING)
# https://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/Internationalization/ManagingTranslations.html
page.meta.robots = noindex, nofollow
page.meta.robots.replace = 1
page.10.partialRootPaths.3 = fileadmin/user_upload/template/partials/ContentElements/
page.10.partialRootPaths.4 = fileadmin/user_upload/template/Partials/Page/
page.10.dataProcessing.10.levels = 3
page.includeJSFooterlibs.bootstrap_navbar = fileadmin/user_upload/template/js
page.includeJSFooterlibs.bootstrap_navbar = fileadmin/user_upload/template/js/navbar.js
lib.contentElement.partialRootPaths.20 = fileadmin/user_upload/template/partials/ContentElements/
lib.contentElement.partialRootPaths.20 = fileadmin/user_upload/template/Partials/ContentElements/
lib.gridelements.defaultGridSetup {
// stdWrap functions being applied to each element
columns {
default {
renderObj = COA
renderObj {
# You can use registers to i.e. provide different image settings for each column
# 10 = LOAD_REGISTER
20 =< tt_content
# And you can reset the register later on
# 30 = RESTORE_REGISTER
}
}
}
# if you want to provide your own templating, just insert a cObject here
# this will prevent the collected content from being rendered directly
# i.e. cObject = TEMPLATE or cObject = FLUIDTEMPLATE will be available from the core
# the content will be available via fieldnames like
# tx_gridelements_view_columns (an array containing each column)
# or tx_gridelements_view_children (an array containing each child)
# tx_gridelements_view_column_123 (123 is the number of the column)
# or tx_gridelements_view_child_123 (123 is the UID of the child)
}
lib.tt_content.shortcut.pages = COA
lib.tt_content.shortcut.pages {
10 = USER
10 {
userFunc = tx_gridelements_view->user_getTreeList
}
20 = CONTENT
20 {
table = tt_content
select {
pidInList.data = register:pidInList
where = colPos >= 0
orderBy = colPos,sorting
orderBy.dataWrap = FIND_IN_SET(pid,'{register:pidInList}'),|
}
}
}
tt_content.shortcut.5 = LOAD_REGISTER
tt_content.shortcut.5 {
tt_content_shortcut_recursive.field = recursive
}
tt_content.shortcut.20 {
0 {
tables := addToList(pages)
conf.pages < lib.tt_content.shortcut.pages
}
1 {
tables := addToList(pages)
conf.pages < lib.tt_content.shortcut.pages
}
}
tt_content.gridelements_pi1 >
tt_content.gridelements_pi1 = COA
tt_content.gridelements_pi1 {
#10 =< lib.stdheader
20 = COA
20 {
10 = USER
10 {
userFunc = tx_gridelements_view->main
setup {
default < lib.gridelements.defaultGridSetup
}
}
}
}
The statics i included is:
Bootstrap Package: Full Pacakage (bootstrap_package)
Bootstrap Package: Bootstrap 4.x (SCSS) (bootstrap_package)
XML Sitemap (seo)
Gridelements w/DataProssing (recommended) (gridelements)
Gallery (bm_image_gallery)
EDIT2:
New TypoScript with DataProcessing
lib.gridelements.defaultGridSetup =< lib.contentElement
lib.gridelements.defaultGridSetup {
templateName.field = tx_gridelements_backend_layout
templateName.ifEmpty = GridElement
layoutRootPaths {
1 = EXT:gridelements/Resources/Private/Layouts/
}
partialRootPaths {
1 = EXT:gridelements/Resources/Private/Partials/
}
templateRootPaths {
1 = EXT:gridelements/Resources/Private/Templates/
}
dataProcessing {
10 = GridElementsTeam\Gridelements\DataProcessing\GridChildrenProcessor
10 {
default {
as = children
# Default options of the grid children processor
# Change them according to the needs of your layout
# Read more about it in the TypoScript section of the manual
# options {
# sortingDirection = ASC
# sortingField = sorting
# recursive = 0
# resolveFlexFormData = 1
# resolveBackendLayout = 1
# respectColumns = 1
# respectRows = 1
# }
}
}
}
}
My includes:
Fluid Contetn Elements (fluid_styled_content)
Fluid Contetn Elements CSS (fluid_styled_content)
Bootstrap Package: Full Pacakage (bootstrap_package)
Bootstrap Package: Bootstrap 4.x (SCSS) (bootstrap_package)
XML Sitemap (seo)
Gridelements w/DataProssing (recommended) (gridelements)
Gallery (bm_image_gallery)
The error I get:
Tried resolving a template file for controller action "Standard->3" in format ".html", but none of the paths contained the expected template file (Standard/3.html). The following paths were checked: /httpdocs/typo3conf/ext/bootstrap_package/Resources/Private/Templates/ContentElements/, /httpdocs/typo3conf/ext/gridelements/Resources/Private/Templates/
You probably missed to include the static template of gridelemnts. To do so edit your TS-Root-Template, select in the dropdown at the top "Info/Modify", hit the button "Edit the whole template record", go to tab "Includes" and select gridelements static setup in the Multiselect box on the right.
Please provide more information:
Which static templates have you included at all? Maybe you forgot to include fluid_styled_content?
How does your Typoscript/Flexform setup look like?
For what do you need gridelements?
EDIT: bootstrap_package did not very well together with gridelements in the past. Maybe you should first try to install Benjamin Knott's extension autogrids (see this issue on github for more information)
EDIT 2: Try this Typoscript, it just wraps a section around all elements but maybe you will then see your content in the frontend:
tt_content.gridelements_pi1.20.10.setup {
section < lib.gridelements.defaultGridSetup
section {
wrap >
dataWrap = <section id="c{field:uid}">|</section>
}
}
SOLVED:
I installed an extension that is called "Grids for bootstrap" included it in the template and it worked.
Thnaks for all the help you guys gave!
I think your problem is coming from your fluid code for gridelemnts, you didn't use the right syntax maybe.

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>

Typo3 Fluid Templates - How to set up different templates for different pages

I'm trying to build from scratch a website with typo3 9.5 and setting up different template files for different pages. How do I achieve this?
I'm following the tutorial from https://docs.typo3.org/m/typo3/tutorial-sitepackage/master/en-us/TypoScriptConfiguration/Index.html and also tried the solution with no success provided at Typo3 Fluid Templates How to add multiple templates
Now all pages load the Default template and if I set the default cObject to Alternative, it loads the Alternative.html to all pages, even when the TCA at Typo3 is set correctly for each page:
All Pages Back-end Layout to [Default]
Contact set to [Alternative].
_
page = PAGE
page {
typeNum = 0
// Part 1: Fluid template section
10 = FLUIDTEMPLATE
10 {
templateName = TEXT
templateName.stdWrap.cObject = CASE
templateName.stdWrap.cObject {
key.data = pagelayout
pagets__default = TEXT
pagets__default.value = Default
default = TEXT
default.value = Default
pagets__alternative = TEXT
pagets__alternative.value = Alternative
alternative = TEXT
alternative.value = Alternative
}
templateRootPaths {
0 = EXT:photo/Resources/Private/Templates/Page/
1 = {$page.fluidtemplate.templateRootPath}
}
partialRootPaths {
0 = EXT:photo/Resources/Private/Partials/Page/
1 = {$page.fluidtemplate.partialRootPath}
}
layoutRootPaths {
0 = EXT:photo/Resources/Private/Layouts/Page/
1 = {$page.fluidtemplate.layoutRootPath}
}
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor
10 {
levels = 1
includeSpacer = 1
as = mainnavigation
}
}
}
I want to use for instance a default.html template for all pages except contact page, which will have it's own template ( site_template/Resources/Private/Templates/Page/Alternative.html ).
First:
you should use higher numbers for the paths to your templates.
The higher the number the higher the priority for overriding files with the same name.
second:
there is no field pagelayout. either use layout or better backend_layout and backend_layout_next_level (example configuration with the full usage of configuration for subpages).
Your key values (pagets__default and pagets__alternative) already hint to the usage of backend_layout (pagets__* is the usual key for backend layouts defined in page TSconfig).
Probably the example in the documentation needs some correction. (Pull-request commited)

Show news from selected date using url GET parameter

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
}
}

TYPO3 Constants

Hi in my Constants I have declared a constant
PATH_TO = user_vorlagen
All ok this is the result:
in Setup:
file = Resources/Private/Partials/{$PATH_TO}/landingpage
/LANDINGPAGE_Footer.html
This works the path is correctly rendered:
file = Resources/Private/Partials/user_vorlagen/landingpage/LANDINGPAGE_Footer.html
Now my question: i want change this and use a fe_users field {TSFE:fe_user|user|lockToDomain}.
This gives me the correct result in debug "user_vorlagen", but if I inserted in path
file = Resources/Private/Partials/{TSFE:fe_user|user|lockToDomain}/landingpage...
It doesn't work.
I try file.inserData=1
someone can give me a hint?
The .insertData = 1 functionality is only available in TypoScript objects with stdWrap support and I don't think that the file is supporting that.
Either try:
file = TEXT
file.value = Resources/Private/Partials/{TSFE:fe_user|user|lockToDomain}/landingpage
file.insertData = 1
Or use PHP to insert that variable.
It must work in this context.
lib.MAIL_WRAP = FLUIDTEMPLATE
lib.MAIL_WRAP {
#stdWrap.editPanel = 1
#stdWrap.editPanel.allow = move, edit, hide, new
file = Resources/Private/Partials/{$USER_PATH_MAILINGS}/mail/MAIL_wrap.html
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10.references {
table = tt_content
uid.field = uid
fieldName = assets
}
}
}