I'd like to pass an extension GP variable to a form that I built outside of the plugin. When trying to do so, I used a COA_INT which turned out to output <INT_SCRIPT. instead of the value.
In order to do so, I built this typoscript object:
lib.gpSWord = COA_INT
lib.gpSWord {
# Protects from XSS!
stdWrap.htmlSpecialChars = 1
10 = TEXT
10 {
stdWrap.data = GP:tx_indexedsearch_pi2|search|sword
}
}
and then tried to output it like this (as suggested here:
<f:form.textfield name="search[sword]" value="<f:format.raw>{f:cObject(typoscriptObjectPath: 'lib.gpSWord')}</f:format.raw>" id="tx-indexedsearch-searchbox-sword" class="tx-indexedsearch-searchbox-sword font-h2" />
And also tried building up the variable before hand using f:variable but nothing worked.
The expected result would be that the variable would be set and the value would then be passed to the form.textfield viewhelper but appearently this does'nt work either.
You should commit the variable in Typoscript (setup) with:
page.10 = FLUIDTEMPLATE
page.10.variables.gpSWord < lib.gpSWord
Then you are able to use it in you Fluidtemplate with:
<f:format.raw>{gpSWord}</f:format.raw>
lib.gpSWord = COA_INT
lib.gpSWord {
stdWrap {
wrap = &tx_indexedsearch_pi2[sword]=|
data = GP:tx_indexedsearch_pi2|sword
if.isTrue.data = GP:tx_indexedsearch_pi2|sword
}
}
Try this for GP.
Related
I try to update an Typo3 Installation from 6.1 to 8.7 LTS but i dont get the templates working.
What i did so far:
Updated the core to 6.2 -> 7.6 -> 8.7
Updated all the Extensions as possible
The old installation used Fluid Pages Engine but this is not available for 8.7. As far as i understand it, fluid is now included in typo3?
Backend is working so far. I can administrate users, Pages and everything i looked at. However, when i call the frontend, i get an Exception:
#1294587217: The page is not configured! [type=0][]. This means that there is no TypoScript object of type PAGE with typeNum=0 configured.
TYPO3\CMS\Core\Error\Http\ServiceUnavailableException thrown in file
...\typo3_src-8.7.10\typo3\sysext\frontend\Classes\Controller\TypoScriptFrontendController.php in line 2487.
I tried the solution from the wikipage and replaced the "setup"-Template information
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/typoscript/domain.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/typoscript/typoscript.ts">
page.stdWrap.parseFunc.short.i3 = <span style="text-transform:normal;">i3</span>
with
# Default PAGE object:
page = PAGE
# Define output for typeNum=0, the default type.
page.typeNum = 0
page.10 = TEXT
page.10.value = HELLO WORLD!
Then i see "HELLO WORLD!". Now i stuck: what do i have to do to get the "normal" template working?
Thanks in advance
TYPO3 7 and 8 both include the FLUIDTEMPLATE Typoscript object, but EXT:fluidpages is an external extension mantained by the fluidtypo3.org team.
As you wrote:
# Default PAGE object:
page = PAGE
# Define output for typeNum=0, the default type.
page.typeNum = 0
page.10 = TEXT
page.10.value = HELLO WORLD!
You are defining that the PAGE object will contain only that simpe TEXT object.
A "minimum" configuration to use the FLUIDTEMPLATE object would be:
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10{
templateName = Default
layoutRootPaths {
0 = Path/To/Your/Layouts/
}
partialRootPaths {
0 = Path/To/Your/Partials/
}
templateRootPaths {
0 = Path/To/Your/Templates/
}
}
which means that you are using an Default.html template
to use different templates, you should also configure some backend layouts; assuming that you are using the database to store them the previous code could become:
page = PAGE
page.typeNum = 0
page.10 = FLUIDTEMPLATE
page.10{
templateName= TEXT
templateName.stdWrap {
cObject = CASE
cObject {
key.data = levelfield:-2,backend_layout_next_level,slide
key.override.field = backend_layout
default = TEXT
default.value = Default
//these are the IDs of the backend_layout records in DB
1 = TEXT
1.value = Default
2 = TEXT
2.value = Home
//add other values
}
ifEmpty = Error
}
layoutRootPaths {
0 = Path/To/Your/Layouts/
}
partialRootPaths {
0 = Path/To/Your/Partials/
}
templateRootPaths {
0 = Path/To/Your/Templates/
}
}
See also: https://docs.typo3.org/typo3cms/TyposcriptReference/ContentObjects/Fluidtemplate/Index.html
If you need further help I could suggest you to join the typo3 Slack channel (subscribe here: https://forger.typo3.com/slack) and join the typo3-cms channel and the fluidtypo3 channel.
I think your typoscript file is not included in ROOT Template.
First of copy all typoscript in the typoscript.ts file and paste in the setup.ts in ROOT Template and after check the frontend. If every thing is fine then definitely your typoscript is not included on ROOT template and if this is not working then some mistake in your typoscript object
I am using TYPO3 6.2.
On my website, i make a SQL query this way :
lib.bloc_top = COA
lib.bloc_top.10 < styles.content.get
lib.bloc_top.10.select.selectFields = header
lib.bloc_top.10.select.where = ( deleted = 0 && hidden = 0 && tx_gridelements_container = 2571 && CType = 'header' )
All works but instead of outputting the results as HTML code, I would like to render it in an array that I would use in my FLUID template this way :
<f:for each="{car}" as="el">
<li>Brand : {el}</li>
</f:for>
Is it possible ?
Thanks for your help :)
You should not select the container by a specific UID, but create a "car" container type via Gridelements CE backend layout instead.
Anyway, to get the data into an array, you don't have to do anything special, since this is automatically done by styles.content.get under the hood.
While styles.content.get uses the default tt_content setup, you can change that via renderObj as described here: https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/ContentObjects/Content/
To get the data into your Fluid template you just have to replace the default renderObj with a FLUIDTEMPLATE https://docs.typo3.org/typo3cms/TyposcriptReference/6.2/ContentObjects/Fluidtemplate/Index.html
lib.bloc_top.10.renderObj = FLUIDTEMPLATE
lib.bloc_top.10.renderObj {
file = path/to/your/template/file.html
}
Since the loop is handled by the CONTENT object of styles.content.get, you can skip the f:for part in your template though.
Usually any kind of data is provided within the cObj->data array, so something like <h1>{data.header}</h1> should do the job.
And even with CONTENT there should be a counter, since there is https://docs.typo3.org/typo3cms/TyposcriptReference/DataTypes/Gettext/Index.html#cobj
To get any available data you should use <f:debug>{_all}</f:debug> in your Fluid template.
I modified a part of a working typoscript template from:
10 = COA
10.stdWrap.wrap = <div class="toggleBar">|</div>
10 {
...
to
toggleBarDIV = COA
toggleBarDIV.stdWrap.wrap = <div class="toggleBar">|</div>
toggleBarDIV {
...
Now it is not working anymore. Is it not allowed to use names in typoscript?
Where is it allowed and where not? Where can I get more infos?
As far as I know, COA keys must always be numbers (10,20,1,2...);
There is a feature request about using more meaningful keys:
https://forge.typo3.org/issues/45488
i have a little problem getting a custom content element via typoscript on all pages.
i´ve created a custom element without any extensions (like mask or dce) so im only using
TYPO3 core functions. This Element is a simple thingy that just uses irre for creating
different boxes to be displayed in the frontend.
tt_content.box = COA
tt_content.box {
10 = FLUIDTEMPLATE
10 {
file = EXT:xxx_elements/Resources/Private/Templates/Box.html
partialRootPath = EXT:xxx_setup/Resources/Private/Content/Partials
layoutRootPath = EXT:xxx_setup/Resources/Private/Content/Layouts
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tx_xxxelements_box
orderBy = sorting
where {
data = field:uid
intval = 1
wrap = tt_content=|
}
as = boxitems
}
}
}
}
rendered with normal fluid like
<f:for each="{boxitems}" as="boxitem">
<boxitem.header>...
</f:for>
so everything works fine as long as i use it as a regular content element that is placed
on a page. now i put one element into a storagefolder and try to reuse this element on all pages via typoscript
where 10 is the ID of the content element
lib.SubFooter = COA
lib.SubFooter {
10 = RECORDS
10 {
tables = tt_content
source = 10
}
}
the lib is rendered correct, but the "boxitems" array is empty on all pages :-(
now the funny part:
if i place the element with ID 10 on a page the boxitems array is filled for both element and lib...
Here is an image with the variable dump for different situations:
element, lib, element+lib
Unfortunately, I could not find a satisfactory solution to the problem. In the end, I have built the content element as a normal element instead of IRRE, then the integration with typoscript works as expected.
maybe you're missing the pid ;-)
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
....
pidInList.field = pid
and you can simplify in my opinion in this case the where clause:
where.dataWrap = tt_content={field:uid}
because you're not matching against vars from outside...
I created a COA_INT like this:
lib.linguasitoparametrol = COA_INT
lib.linguasitoparametrol {
10 = TEXT
10.stdWrap.data = GP:L
}
I print in fluid like so:
Value = {f:cObject(typoscriptObjectPath: 'lib.linguasitoparametrol')}
Result is: Value = 0 or Value = 1.
Ok it works.
Now i want to write the variable in a input area so i write:
<f:form.textarea name="search[languageUid]" value="{f:cObject(typoscriptObjectPath: 'lib.linguasitoparametrol')}" />
But i obtain in input value <!--INT_SCRIPT.5e0cf67ea790e31ff7adaa744a7a992c-->
Why? how can i solve it?
The <!--INT_SCRIPT.5e0cf67ea790e31ff7adaa744a7a992c-->should only displayed if you do not cache the page witch contain your template.
<!--INT_SCRIPT.5e0cf67ea790e31ff7adaa744a7a992c--> Is an placeholder for you content that is replaced after cache has build.
You dont need for GP:L a COA_INT object: When you have multiple languages you have allready typoscript conditions for these. So your Cache is build for each of these. The Cache for L=1 is allways different than the cache for L=2.
I would recommend to use it without use of COA:
lib.linguasitoparametrol = TEXT
lib.linguasitoparametrol.data = GP:L
Alternative if you use it in an Fluid Template you can pass the information via variables:
page = PAGE
page.10 = FLUIDTEMPLATE
page.10 {
template = FILE
template.file = fileadmin/templates/MyTemplate.html
partialRootPath = fileadmin/templates/partial/
variables {
currentLangUid = TEXT
currentLangUid.data = GP:L
}
}
And use it in your Fluid Template by {currentLangUid}, so you dont have to use the cObject Viewhelper.