i want to show the title of a file instead of the filename.
version 6.0.14
my typoscript:
tt_content.uploads.20.renderObj.20.wrap = <span class="csc-uploads-fileName"><i class="fileicon-"></i>|</span>
tt_content.uploads.20.itemRendering.30.if.isTrue.field = true
tt_content.uploads.20.renderObj.10.file.width = 80
tt_content.uploads.20.renderObj.40.bytes.labels = Byte | KB | MB | GB
tt_content.uploads.20.renderObj.40.wrap = <span class="badge">|</span>
i tried
tt_content.uploads.20.renderObj.20.data = file:current:title
but i wont to show the filename if the title is empty. i dont know how to do it ...
if you are using Version 6.x use:
tt_content.uploads.20.renderObj.20.data = file:current:description // file:current:name
if you are using an older version try to use that (not tested but should work):
tt_content.uploads.20.labelStdWrap.override.if.isTrue.data = register:description
tt_content.uploads.20.labelStdWrap.override.data = register:description
tt_content.uploads.20.labelStdWrap.insertData = 1
Related
I have this typoscript:
tt_content.gridelements_pi1.20.10.setup {
3cols.outerWrap = <div>|</div>
3cols.outerWrap.override.insertData = 1
3cols.outerWrap.override = <div id="{field:tx_cewrap_id_input}" class="{field:tx_cewrap_class_input} {field:tx_cewrap_class_select}">|</div>
3cols.outerWrap.override.if.isTrue.field = tx_cewrap_active
}
Which makes sure a wrapper is made around a certain element. The following html is generated as an example:
<div id="" class="full-box full-box-features container pt-75,pb-75"></div>
As you can see there is a comma separated string inserted as "tx_cewrap_class_select". With the {field:tx_cewrap_class_select} part:
pt-75,pb-75
But i want the comma to be a space character so the classes work in html
Now I know about the split option
But how do I fix the code, just need somehow to remove the comma! That's it :)
Thanks in advance for any response I can use.
You can split by comma and join with a space, but in this case it might be easier just to replace the comma by space:
10 = TEXT
10.replacement {
1 {
search = ,
replace.char = 32
}
}
And here the solution with split. it should be obvious why not to use:
10 = TEXT
10.split {
token = ,
cObjNum = 1 || 2
1.current = 1
2.current = 1
2.noTrimWrap = | ||
}
Hint:
on TEXT you can use stdWrap functions immediately,
in other context you might need an explicit .stdWrap:
10.stdWrap.replacement {
10.stdWrap.split {
Either you prepare your values into a register for later use, or you split your override value into a COA. You even might use the replacement on the whole override value in case you are sure no other comma might be needed.
COA-Solution:
(don't forget the noTrimWrap for 20 otherwise the classes are appended without space)
override.cObject = COA
override.cObject {
10 = TEXT
10.value <div id="{field:tx_cewrap_id_input}" class="{field:tx_cewrap_class_input}
10.insertData = 1
20 = TEXT
20.field = tx_cewrap_class_select
20.replacement {
1 {
search = ,
replace.char = 32
}
noTrimWrap= | ||
}
30 = TEXT
30.value = ">|</div>
}
I've set up the Typoscript below, but the last line doesn't work.
I want 20.filelink to have the same content as 10.filelink (the real code is more complex and that bit is redundant).
lib.test = COA
lib.test {
10 = TEXT
10.value = A value
10.filelink {
path = fileadmin/path/
target = blank
stdWrap.wrap = <li>|</li>
}
20 = TEXT
20.if.isFalse.data = subheader
20.value = Another value
20.filelink =< lib.test.10.filelink
}
Copying (with the < operator) works, but not =< as stated.
I've also tried without the lib.test. or with just = but without any success.
Is what I want to do possible?
What did I not understand about operators?
you should put it out of the curly brackets :
lib.test = COA
lib.test {
10 = TEXT
10.value = A value
10.filelink {
path = fileadmin/path/
target = blank
stdWrap.wrap = <li>|</li>
}
20 = TEXT
20.if.isFalse.data = subheader
20.value = Another value
}
lib.test.10.filelink =< lib.test.20.filelink
I figured out what I did not understand. Apparently, you can only copy or reference Content Objects.
The answer then is to reference the entire object, and to modify and add what needs changing. In this case it would be:
lib.test = COA
lib.test {
10 = TEXT
10.value = A value
10.filelink {
path = fileadmin/path/
target = blank
stdWrap.wrap = <li>|</li>
}
20 = < lib.test.10
20.if.isFalse.data = subheader
20.value = Another value
}
I try to overwrite the typoscript of the extension tx_seobasics. In the tx_seobasics setup.txt I have:
plugin.tx_seobasics {
# Building the page title
10 = TEXT
10.data = page:tx_seo_titletag // page:title
10.trim = 1
10.stdWrap.stdWrap.append = TEXT
10.stdWrap.stdWrap.append.data = TSFE:tmpl|sitetitle
10.stdWrap.stdWrap.append.trim = 1
10.stdWrap.stdWrap.append.required = 1
10.stdWrap.stdWrap.append.if.isTrue = {$plugin.tx_seo.titleWrapAppendSiteTitle}
10.stdWrap.stdWrap.append.noTrimWrap = | - ||
10.stdWrap.noTrimWrap = {$plugin.tx_seo.titleWrap}
10.stdWrap.insertData = 1
10.htmlSpecialChars = 1
10.wrap = <title>|</title>
10.append < .5
20 < .10
20.wrap = <meta name="title" content="|" />
}
Now the idea is that I can set the value for 10.stdWrap.stdWrap.append.data individual for each language.
So my first step/test was I add following typoscript in the setup.txt of my own template:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.data = page:title
This works and instead of the sitetitle that is defined in the template I get the pagetitle as sitetitle.
Now I have 2 problems:
SOLVED First problem: Overwrite .data with .value
Instead of a field I want to add a value directly in typoscript, my idea was:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text
or
plugin.tx_seobasics.10.stdWrap.stdWrap.append = TEXT
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text
both options dont overwrite anything and it still takes the .data = TSFE:tmpl|sitetitle.
So how to overwrite .datawith .value?
Second problem: Set the value for each language separately.
My typoscript setup.txt looks like this:
[globalVar = GP:L = 1]
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_template/Configuration/TypoScript/setup-ch.txt">
[global]
[globalVar = GP:L = 2]
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:my_template/Configuration/TypoScript/setup-en.txt">
[global]
Edit: I had a mistake in my language files: I was closing 2 brackets } } on the same line. Never thought about it, but typoscript seems to not like that.
I currently have no idea for the language-condition problem but for overwriting the .data you should try to empty the data first:
plugin.tx_seobasics.10.stdWrap.stdWrap.append.data >
plugin.tx_seobasics.10.stdWrap.stdWrap.append.value = My own text
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
}
}
}
I am using the typoscript below to display news content via a CONTENT object. Everything is working great except the link doesn't go to the page of the article. Is there a way to tell the typolink that this is a news article and that it should use the cached CoolURI link for it?
Also, the additionalParameter I'm trying to append to the querystring isn't appearing.
temp.MMtest = COA
temp.MMtest {
10 = CONTENT
10.table = tt_news
#10.select.pidInList = 170 # Uid of the sysfolder where News records are stored
10.select.pidInList = 18
10.select.recursive = 10
#10.select.where = uid=10 # Uid of an existing News record
10.select.andWhere = deleted=0 AND hidden=0
10.renderObj = COA
10.renderObj {
10 = TEXT
10.field = title
10.wrap = Title: |<br>
10.typolink.parameter.field=uid
typolink.parameter.dataWrap=|
#typolink.additionalParams.insertData=1
typolink.additionalParams.data=&my_extra_param=something
#if.isTrue.field=header
}
10.renderObj.20=IMAGE
10.renderObj.20{
wrap=|
# show it only if inserted
stdWrap.if.isTrue.field=image
stdWrap.typolink.parameter.field=uid
file.import=uploads/pics/
file.import.field=image
file.width=100
file.height=100
}
}
I do not know, which parameters you need, so in short:
10.typolink {
# you need a page to link too
parameter = PAGE_ID_OF_SINGLE_VIEW
# create an cacheable link, that does not depend on cooluri or realurl.
useCacheHash = 1
# add the additional params
additionalParams.wrap = &tx_ttnews[uid]=|
# data expects special commands
# "&my_extra_param=something" cannot work on .data
additionalParams.data = field:uid
}
If you need more then one additionalParams i would do it this way:
10.typolink {
parameter = PAGE_ID_OF_SINGLE_VIEW
useCacheHash = 1
# Create an Content Object Array
# so you can separat the different entries
# the cObject will return &tx_ttnews[uid]=123&what[ever]=hardcodedvalue
# additionalParams is filled with that string and added to the url
additionalParams.cObject = COA
additionalParams.cObject {
10 = TEXT
10.wrap = &tx_ttnews[uid]=|
10.field = uid
20 = TEXT
20.wrap = &what[ever]=|
20.value = hardcodedvalue
}
}
You do not need
10.select.andWhere = deleted=0 AND hidden=0
this is added automatically by the CONTENT Object.
Read more about typolink about COA and about stdWrap and its property data and finally have a look at getText.