Download the PHP package wdb/wdb-content-conditions without Composer

On this page you can find all versions of the php package wdb/wdb-content-conditions. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wdb-content-conditions

TYPO3 extension "WDB Content conditions"

This extension adds a TypoScript condition to check if content elements with special values on a site exist. Included are two conditions, ttContent() and tt_content[]:

  1. A functional condition
    This is verifying all content elements on a page
    The syntax is:

    ttContent([fieldname], [expected value], [type of value])

    return value: bool / array

    Parameters:

    • fieldname: the field to verify.
    • expected value: the value that shall be checked, optional.
    • type of value: the datatype of the value, optional.

    Due to the return value, and the limit of available operators, it's NOT useful to combine it with further comparisons like a > b. Nevertheless several conditions can be used together concatenated with || (OR) or && (AND).

    Important to understand is that no content elements are returned, but that the new condition is doing most often a boolean check.
    That means that above any condition the content elements have the same amount and properties like below, content elements are not filtered by the condition.

    Note that all queries exclude deleted or hidden records without exception.

  2. An array condition to a verify single content element This can be used to check properties of single elements and even combine several to check several properties of single elements. The syntax is:

    tt_content[uid][fieldname]

    return value: string / integer
    Return values are just what is saved in the database, this doesn't respect any relations to files or other records.

    Array Keys:

    • uid: the unique id for the tt_content record to verify.
    • fieldname: the field to verify.

Use case for the additional condition:

Checking for values in content elements allows to include special CSS, JS or to configure other page- or config-related values only if it's required.
Example:

Explanation:

Special use case: manipulating content rendering

Certainly it's also possible to change definitions for rendering of content elements based on properties of one (perhaps even unreleated) content element. This could be menus but also other content elements. Nevertheless, as neither the content elements nor the rendering definitions of a page are filtered, those changes would relate to all content elements on the page.
Example:
The condition [ttContent("header_layout", 3, "int")] checks in all content elements on a page if the value 3 is saved in the field header_layout. Imagine there is one record, that has this value and this record's headline shall be wrappedd additionally to the h3-tag with the em-tag. But the code tt_content.header.stdWrap.wrap = '<em>|<em>' would wrap the headlines of all content elements, no matter which value they have assigned.

@TODO: whats about operators like &&, xor, etc.?
@TODO: whats about FlexForm values?
@TODO: test null-values
@TODO: update examples below, ttContent(field, value, type) example: [ ttContent("tx_webcan_st_bt_element", 5, "int") ]

Examples for the functional condition:

[ttContent("colPos", 1, "int")]
Checks if the field colPos of a tt_content record on the page has the value 1.

[ttContent("subheader")]
Checks if the field subheader of any tt_content record on the page is filled.

[ttContent("header", "Home", "str")]
Checks if the field header of a tt_content record on the page has the value "Home".

[ttContent("header", "Home", "str") || ttContent("header", "Homa", "str")]
Checks if the field header of a tt_content record on the page has the value "Home" or "Homa".

[ttContent("header", "Home", "str") && ttContent("header", "Homa", "str")]
Checks if the field header of a tt_content record on the page has the value "Home" and another tt_content record the value "Homa".
This example might explain that the data are coming from a pool of records and that a conclusion if these are coming from the same record is usually not possible. If the requested fields are the same, combined by an AND (&&), surely they can't come from the same record. So it's impossible with this condition, to check if two different properties (field values) belong to the same record.

Examples for the condition in array form:

[tt_content[15]["colPos"] == 1]
Checks if the field colPos of the tt_content record with the uid 15 on the page has the value 1.

[tt_content[15]["subheader"]]
Checks if the field subheader of the tt_content record with the uid 15 on the page is filled.

[tt_content[15]["header"] == "Home"]
Checks if the field header of the tt_content record with the uid 15 on the page has the value "Home".

[tt_content[15]["header"] == "Home" || tt_content[15]["subheader"] == "Welcome"]
Checks if the field header of the tt_content record with the uid 15 on the page has the value "Home" OR the field subheader the value "Welcome".

[tt_content[15]["header"] == "Home" && tt_content[15]["subheader"] == "Welcome"]
Checks if the field header of the tt_content record with the uid 15 on the page has the value "Home" AND the field subheader the value "Welcome". This example shows that the data are coming from the same record and it can be be useful to have the uid of a distinct record to verify something.
String comparisons like in this example might be useful to combine with a 3rd condition of the same kind, verifying the field sys_language_uid for the record-language: [tt_content[15]["header"] == "Home" && tt_content[15]["subheader"] == "Welcome"] && tt_content[15]["sys_language_uid"] == 1]


All versions of wdb-content-conditions with dependencies

PHP Build Version
Package Version
Requires typo3/cms-core Version ^10.4.43 || ^11.5.35
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wdb/wdb-content-conditions contains the following files

Loading the files please wait ....