TYPO3: FCE with FLUID but without an Extension - typo3

I have always used the extension Gridelements for my pages. Now I want to get away from using extensions for FCE. Is there a way with FLUID and Flexforms or similar to implement that as with gridelements?
For example, a bootstrap DIV "row" that contains a two-column element.

You could make a content element which contains 2 rows and which can have IRRE tt_content elements. I think there are enough examples how to make own content elements.
Additional for inline tt_content within tt_content records:
in SQL make a couple extra columns for tt_content 2 for the content and 2 for the foreign key
use a dataprocessor in typoscript to retrieve the IRRE tt_content records
use overrideChildTca in TCA/Overrides/tt_content.php to set the colPos to 99 or so for the inline IRRE record fields (else the content elements will appear double on the page).
set in the backend layout configuration of your main templates a fake column with colPos 99 to avoid TYPO3 9.5 warning that the inline content elements are not in a used column
Not sure if this is the best approach, but it will work. I guess you could also make it multidimensional by having inline in inline elements so you could make x columns. However I would just use Gridelements.

Related

TYPO3 find tt_content from pages

I'm using TYPO3 10.4.14
I believe, that I understood the relationship of pages and tt_content. But I have not figured out, how to get the tt_content elements and the order from the table pages.
From tt_content it is easy to get the page, but not from pages to tt_content.
What I finally want to do, is to mark a page (additional column), for display the beginning of the page in an overview.
For that I need the content elements of a page!
Edit:
I want to do t with database query.
One possible way would to use the uid of pages and go to the tt_content and search there for the pid. But this is a long winded way.
How is TYPO3 it doing, when display the pages?
you have multiple ways to render any output (typical HTML):
typoscript
PHP
FLUID
(in the end all is PHP, but regarding what you are programming or configuring)
If you want to render some regular content of the current page you will use the defined typoscript styles.content.get (with modifications), which is a TypoScript CONTENT object. This will do a query to get those tt_content records which belong to the current page in the default (or other) column. This results in a query like SELECT * FROM tt_content WHERE pid = current_page_uid AND column = 0 (and some additional conditions regarding visibility (hidden, starttime, endtime, workspace, ...)
This could be assigned to a FLUID variable or requested by a viewhelper (f:cObject).
If you want to get content from another than the current page you need to do a similar request and use another page uid. Either you build your own CONTENT object and use it like the default content. Or you build an own viewhelper in PHP which you can use in FLUID. You can modify the query by reducing the number of records you consider, you also can modify the rendering regarding which fields will be shown in what HTML markup.
Depending on the package you use it may contain already specialized viewhelper which gets you the content of other pages and/or other columns.
I think you want to build teasers for other pages with the content of that pages.
Consider to use a special field in the pages record which contains a clean summary for the page content. Not each page has relevant or recognizable information in the first paragraph.
It's the same as for search engines: if you provide search engines with a summary, that will be shown at the search results and the searcher can better decide if this page is relevant for him.

Add limit to Content Element

I setup a website with TYPO3 9x and I inserted a Content Element with this type :
Categorized content [menu_categorized_content]
The objective is to show the contents that are in a given category.
But I need to limit the number of content records to show only 3 records.
How can I add this function to limit to number of content ?
TYPO3 is using the DatabaseQueryProcessor to fetch the records from DB.
Your can find the settings in:
typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/MenuCategorizedContent.typoscript
The DatabaseQueryProcessor uses the default .select syntax from TypoScript, you can find the Docs here: https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#comprehensive-example
You can just add this to your TypoScript:
tt_content.menu_categorized_content.dataProcessing.10.max = 3

How can I store flux form fields defined in TYPO3 page templates in database columns instead of flex fields?

Using flux to create custom content elements for TYPO3, fields that are defined in a flux:form are stored in a flex field as XML by default. By the solution Claus Due pointed out here (Fluidtypo3 Flux - save in table field), they can also be stored as individual columns in tt_content.
Now, when creating page templates and defining template parameters as flux input fields, could those be stored as indiviual columns in the "pages" table?
The obvious approach to do this in the same way as described for content elements, i.e.:
<flux:field.text name="pages.extrafield" label="Content" />
did not work. (I created the field "extrafield" in the pages table using my extension's ext_tables.sql)
The format you used is the correct one, but in order to get the field saved it first must be 1) allowed for the user who saves and 2) shown somewhere in the form; types passthrough and none should also work.
The last requirement is a safeguard added in a recent major version and is there to prevent doing things that normally would be prohibited by access settings or field availability.

Render headline of first content element in Grid Container different

Is it possible to render the headline of the first content element within a Grid Elements container different in the fluid_styled_content template or via TypoScript?
There are several virtual fields within cObj->data that are created during the rendering process of Gridelements. So you might want to check for keys with the prefix parentgrid_
Additionally you can use
data = cObj:parentRecordNumber
to get the position of an element within the rendering order. Since Gridelements uses the sorting field of tt_content for the rendering of children and the parentRecordNumbers are handled correctly between different container columns, you should get the correct value - 1 - for the first element of each column there.

TYPO3 Insert records element: detect number of items

Is there any way to detect in fluid or typoscript (or anything else) if an "Insert Records" CE from fluid_styled_content contains one or multiple items?
The use case:
I use "insert records" to display contacts from a custom extbase extension on a page, and I'd like to get a different title and layout if there are one or several items.
Insert Records is rendered using the RECORDS content object. In \TYPO3\CMS\Frontend\ContentObject\RecordsContentObject::render() I see no option to read the number of items or the current item number that is rendered from the contentObjectRenderer object that renders a single item.