TSFE:lastImgResourceInfo|filesize equivalent in TYPO3 7.6 or 8.7 - typo3

Back in TYPO3 4.5 there was TSFE:lastImgResourceInfo|filesize to access the filesize of the last rendered image in TypoScript. Is there an equivalent in TYPO3 7.6.x or 8.7.x?
I would need it here:
70 = CONTENT
70 {
table = tt_content
select {
orderBy = sorting
where = colPos=0
pidInList.data = field : content_from_pid
max = 1
}
wrap = <enclosure type="image/jpeg" url="{$rssFeed.feedBaseUrl}|" />
renderObj = COA
renderObj {
10 = FILES
10 {
references {
table = tt_content
uid.data = uid
fieldName = image
}
renderObj = COA
renderObj {
10 = IMG_RESOURCE
10 {
file {
import.data = file:current:originalUid
width.field = imagewidth
maxW = {$rssFeed.feedImageMaxWidth}
}
}
20 = TEXT
# this used to work in TYPO3 4.5
20.data = TSFE:lastImgResourceInfo|filesize
20.wrap = " length="|
}
}
}
}

Should be TSFE:lastImageInfo, even in TYPO3 4.5. Seems to be set in later versions, too.

TSFE:lastImgResourceInfo still exists in 7.x and later, but the field filesize is gone. I couldn't find any information in the code where it has gone.

Related

Typoscript: Get image path of fe user associated image

I'm trying to show informations of a single Fe user with typoscript. Everything is working fine except I can't get the image path. How can I get the path to the associated image?
Thanks for pointing me in the right direction.
Noël
EDIT:
Hi, I'm using TYPO3 version 9.5.21.
The TS code to get the fe user data:
lib.feUserLink = CONTENT
lib.feUserLink {
table = fe_users
select {
pidInList = 16
max = 10
orderBy = last_name DESC
}
renderObj = COA
renderObj {
10 = TEXT
10.field = username
10.typolink {
parameter = 483
additionalParams.dataWrap = &user={field:uid}
useCacheHash = 1
}
10.wrap = |</br>
20.### here I'd like to get the image path###
}
}
In TypoScript you can use the objects FILES and IMAGE in order to get an image, you can try something like this I guess :
lib.feUserLink = CONTENT
lib.feUserLink {
table = fe_users
select {
pidInList = 16
max = 10
orderBy = last_name DESC
}
renderObj = COA
renderObj {
10 = TEXT
10.field = username
10.typolink {
parameter = 483
additionalParams.dataWrap = &user={field:uid}
useCacheHash = 1
}
10.wrap = |</br>
20 = FILES
20 {
references {
table = fe_users
uid.data = {field:uid}
fieldName = image
}
renderObj = IMAGE
renderObj {
file.import.data = file:current:originalUid
}
}
}
}

TYPO3 - simpler way, rendering content from colPos into Fluidtemplate?

The official TYPO3 Documentation explains how to create (or copy) and use a lib.dynamicContent to render columns into a Fluidtemplate.
I do not understand exactly whats going on in this example.
The TypoScript there is:
lib.dynamicContent = COA
lib.dynamicContent {
10 = LOAD_REGISTER
10.colPos.cObject = TEXT
10.colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
20 = CONTENT
20 {
table = tt_content
select {
orderBy = sorting
where = colPos={register:colPos}
where.insertData = 1
}
}
90 = RESTORE_REGISTER
}
I use this snippet in a ton of TYPO3 projects and often had asked myself whats going on there.
I have changed this by experimenting a bit and ended with:
lib {
dynamicContent = COA
dynamicContent {
10 = CONTENT
10 {
table = tt_content
select {
orderBy = sorting
where {
data = field:colPos
wrap = colPos=|
}
}
}
}
}
That seems to do "exactly the same" thing - it outputs my content when called via cObject ViewHelper.
Can somebody explain if or why this is the worse way to render Content?
Here's the link to the lib.dynamicContent-doc: https://docs.typo3.org/c/typo3/cms-fluid-styled-content/master/en-us/Installation/InsertingContentPageTemplate/Index.html#based-on-the-fluidtemplate-content-object-cobj
Here you go!
you can try this,
# Clear out any constants in this reserved room!
styles.content >
# get content
styles.content.get = CONTENT
styles.content.get {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
}
# Left Column
styles.content.getLeft < styles.content.get
styles.content.getLeft.select.where = colPos=1
# Right content
styles.content.getRight < styles.content.get
styles.content.getRight.select.where = colPos=2
Also, you can use variable in the fluid page object, check this out:
lib.pageTemplate = FLUIDTEMPLATE
lib.pageTemplate {
variables {
content = CONTENT
content {
table = tt_content
select.orderBy = sorting
select.where = colPos=0
}
contentRight = CONTENT
contentRight {
table = tt_content
slide = -1
select.orderBy = sorting
select.where = colPos=2
}
}
}
You can find out more here:
Adding the page content to a fluid template
Typo3 7.6 typoscript problems with markers
Hope this make sense, Cheer...!
You should look at this snippet together with some information about the Fluid view helper <f:cObject> which can be found here: https://docs.typo3.org/other/typo3/view-helper-reference/9.5/en-us/typo3/fluid/latest/CObject.html
As you can see there are the parameters data, currentValueKey and table that will be handed over to the typoscriptObjectPath, which is why the snippet makes perfect sense. The reason is, that it's a bit hard to put the different options into the where clause of the CONTENT object. So it increases readability and those registers can be easily extended.
So the register in this example is used to put in either the value of the data field colPos or if that is empty it will take the current value from the currentValueKey and if that is empty too it will fall back to a value of 0 to make sure the query won't produce an exception.
lib.dynamicContent = COA
lib.dynamicContent {
10 = LOAD_REGISTER
10.colPos.cObject = TEXT
10.colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
20 = CONTENT
20 {
table = tt_content
select {
orderBy = sorting
where = colPos={register:colPos}
where.insertData = 1
}
}
90 = RESTORE_REGISTER
}
We used a modified version of that snippet to sneak in some more parameter values for the CONTENT object.
So we can hand over a data field pageUid, if that is not set we will use the uid of the current page. This will be overriden if the current or the target page is configured to show content from another page and finally we can trigger a slide with another data field.
lib.dynamicContent = COA
lib.dynamicContent {
5 = LOAD_REGISTER
5 {
colPos.cObject = TEXT
colPos.cObject {
field = colPos
ifEmpty.cObject = TEXT
ifEmpty.cObject {
value.current = 1
ifEmpty = 0
}
}
pageUid.cObject = TEXT
pageUid.cObject {
field = pageUid
ifEmpty.data = TSFE:id
}
contentFromPid.cObject = TEXT
contentFromPid.cObject {
data = DB:pages:{register:pageUid}:content_from_pid
data.insertData = 1
}
}
20 = CONTENT
20 {
table = tt_content
slide = -1
slide.if.isTrue.field = slide
select {
includeRecordsWithoutDefaultTranslation = 1
orderBy = sorting
where = {#colPos}={register:colPos}
where.insertData = 1
pidInList.data = register:pageUid
pidInList.override.data = register:contentFromPid
}
}
90 = RESTORE_REGISTER
}
This enables us to make use of the <f:cObject> view helper while triggering additional parameters just by handing over some more values within the data array.

Set dynamic _DEFAULT_PI_VARS

I must set plugin.tt_news._DEFAULT_PI_VARS.tt_news to show the latest news by default. So I get the uid of the latest news via CONTENT.
temp.newsUid = CONTENT
temp.newsUid {
table = tt_news
select {
pidInList = 12345
orderBy = datetime DESC
join = tt_news_cat_mm ON tt_news_cat_mm.uid_local = tt_news.uid
where = tt_news_cat_mm.uid_foreign = 4711 AND tt_news.deleted = 0 AND tt_news.hidden = 0
max = 1
}
renderObj = COA
renderObj {
10 = TEXT
10.field = uid
}
}
plugin.tt_news._DEFAULT_PI_VARS.tt_news = temp.newsUid
will not work. But how can I do it?
This will work:
plugin.tt_news._DEFAULT_PI_VARS.tt_news.stdWrap.cObject < temp.newsUid

Typo3 Powermail Prefill

Im using Typo3 and got 2 Powermail Forms on a Hotel Page.
One small form on every Page where you can put the checkin and checkout date.
After this you will be redirected to the main form.
How can i prefill the daterecords from the small after the redirect in the mainform?
Both forms have the same variable names {checkin} and {checkout}
Thanks
Try it..
plugin.tx_powermail.settings.setup.prefill {
# Fill field with marker {current_date}
current_date = TEXT
current_date{
data = date : U
strftime = %d-%m-%Y %H:%M:%S
}
form2date = TEXT
form2date{
data = date : U
strftime = %d-%m-%Y %H:%M:%S
}
seminar = CONTENT
seminar {
table = tx_news_domain_model_news
select.pidInList = 118
select.where.stdWrap.cObject = TEXT
select.where.stdWrap.cObject.data = GP:tx_news_pi1|news
select.where.stdWrap.cObject.wrap = uid = |
select.where.stdWrap.cObject.insertData =1
renderObj = COA
renderObj {
10 = TEXT
10.dataWrap ={field:title}
}
}
price = CONTENT
price {
table = tx_news_domain_model_news
select.pidInList = 118
select.where.stdWrap.cObject = TEXT
select.where.stdWrap.cObject.data = GP:tx_news_pi1|news
select.where.stdWrap.cObject.wrap = uid = |
select.where.stdWrap.cObject.insertData =1
renderObj = COA
renderObj {
10 = TEXT
10.dataWrap ={field:price}
}
}
location = CONTENT
location {
table = tx_news_domain_model_news
select.pidInList = 118
select.where.stdWrap.cObject = TEXT
select.where.stdWrap.cObject.data = GP:tx_news_pi1|news
select.where.stdWrap.cObject.wrap = uid = |
select.where.stdWrap.cObject.insertData =1
renderObj = COA
renderObj {
10 = TEXT
10.dataWrap ={field:tx_roqnewsevent_location}
}
}
event_startdate = CONTENT
event_startdate {
table = tx_news_domain_model_news
select.pidInList = 118
select.where.stdWrap.cObject = TEXT
select.where.stdWrap.cObject.data = GP:tx_news_pi1|news
select.where.stdWrap.cObject.wrap = uid = |
select.where.stdWrap.cObject.insertData =1
renderObj = COA
renderObj {
10 = TEXT
10.value.field = tx_roqnewsevent_startdate
10.value.date = d-m-Y
#10.strftime = %d-%m-%Y
}
}
}
Hi try add (width js on submit action) in form action url or redirect url width parametrs [checkin]="" and [checkout]="". Like this
<form class="form-horizontal powermail_form powermail_form_1" action="index.php?id=5&checkin=25.05.15&checkout=25.06.15" method="post">
...
for test try use url "yousite.com/index.php?id=5?checkin=25.05.15&checkout=25.06.15" fields in form must be fill.
Where "5" - your main form page id

Refer to media field of original language in TYPO3

In TYPO3 6.2 (just upgraded from 4.5) I have a TMENU with Images, using a cObject in NO to build the menu as desired.
It works in the main language, but in the second language's frontend, the images are not rendered - unless they are filled in in the second language's media field.
How do you force FILES to refer to the media field of the original language?
In my case, always. In other cases, a fallback solution may be desired.
temp.menu = COA
temp.menu {
wrap = <div class="teasermenu">|</div>
15 = HMENU
15 {
special = list
//special.value.cObject < temp.displayedpages
// recieves a list, such as:
special.value = 1,3,9
1 = TMENU
1 {
noBlur = 1
maxItems = 16
wrap = <ul>|</ul>
NO {
wrapItemAndSub = <li>|</li>
ATagBeforeWrap = 1
ATagParams = || || || || class="red" |*| |*|
stdWrap.cObject=COA
stdWrap.cObject{
10 = TEXT
10.field = nav_title // title
10.wrap = <strong class="teasermenu_header">|</span></strong>
20=FILES
20{
if{
isInList.field = uid
//value.cObject < temp.displayedpages_wimage
// receives another list, like:
// value = 3,9
}
references {
table=pages
fieldName=media
}
renderObj=IMAGE
renderObj{
file{
height=80
maxH=80
import.data=file:current:publicUrl
}
altText.field=title
titleText.field=title
}
}
}
}
}
}
}
PS there are many media field / FAL fallback related bugs on forge, e.g. this one. But I have a feeling this might be a simpler issue.
mergeIfNotBlank is gone now, the current solution (TYPO3 8.7) seems to be to set
$GLOBALS['TCA']['pages']['columns']['media']['config']['behaviour']['allowLanguageSynchronization'] = 1;
But based on https://forum.typo3.org/index.php/t/217033/-typo3-ug-freiburg-media-feld-in-den-seiteneigenschaften (thanks) there's this snippet. It also works with cropVariants:
temp.bgimg_wide = CONTENT
temp.bgimg_wide{
table = sys_file_reference
select{
pidInList = {$pids.pidHome}
where = tablenames='pages' AND fieldname='media'
orderBy = sorting_foreign
languageField = 0
selectFields = uid_local
max = 1
begin = 0
}
renderObj = FILES
renderObj{
files.stdWrap.field = uid
renderObj = IMG_RESOURCE
renderObj {
file {
import.data = file:current:uid
treatIdAsReference = 1
width = 1600
cropVariant = bgimg_wide
}
}
}
}
}
This works!
With TYPO3 CMS 7.6 you need to exclude field media of table pages from [FE][pageOverlayFields] as set in ~/typo3_src-7.6.10/typo3/sysext/core/Configuration/DefaultConfiguration.php, until it is solved - see forge issue https://forge.typo3.org/issues/65863
Write in your AdditionalConfiguration
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] = 'uid,doktype,title,subtitle,nav_title,keywords,description,abstract,author,author_email,url,urltype,shortcut,shortcut_mode';
or in your Extension ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields'] = str_replace(',media', '', $GLOBALS['TYPO3_CONF_VARS']['FE']['pageOverlayFields']);
Based on Urs' answer, here comes a slight variation.
lib.getCurrentPageMedia = CONTENT
lib.getCurrentPageMedia {
table = sys_file_reference
select{
pinInList = root, this
where = tablenames='pages' AND fieldname='media' AND uid_foreign=###pid###
orderBy = sorting_foreign
languageField = 0
selectFields = uid_local
max = 1
begin = 0
markers {
pid.data = TSFE:id
}
}
renderObj = TEXT
renderObj.stdWrap.field = uid
}
Fluid:
<f:image src="{f:cObject(typoscriptObjectPath:'lib.getCurrentPageMedia')}" alt="" width="400c" height="400c" treatIdAsReference="1" class="img-responsive" />
Advantage: you can define cropping, alt-text, etc. in your template.
You might want to try to set the TCA of the media field to l10n_mode => mergeIfNotBlank .
http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Index.html#columns-properties-l10n-mode
Put this into the typo3conf/AdditionalConfiguration.php:
$TCA['pages']['columns']['media']['l10n_mode'] = 'mergeIfNotBlank';
Since this issue is from Februari, you've probably found a solution by now. I just ran into this issue and solved it by including:
$GLOBALS['TCA']['pages_language_overlay']['columns']['media']['l10n_mode'] = 'mergeIfNotBlank';
in my ext_tables.php