---
title: "Using site configuration in TCA foreign_table_where"
manual: "TYPO3 Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3coreapi:sitehandling-intca@main"
source: "ApiOverview/SiteHandling/UseSiteInTCA.rst"
rendered: "2026-09-21T11:24:09+00:00"
---

# Using site configuration in TCA `foreign_table_where` {#sitehandling-intca}

## TCA: `foreign_table_where` {#sitehandling-in-tca-tca-foreign-table}

The `foreign_table_where` setting in TCA allows marker-based
placeholders to customize the query. The best place to define site-dependent
settings is the site configuration, which can be used within
`foreign_table_where`.

To access a configuration value the following syntax is available:

-   `###SITE:<KEY>###` \- \<KEY> is your setting name from site config e.g. `###SITE:rootPageId###`
-   `###SITE:<KEY>.<SUBKEY>###` \- an array path notation is possible. e.g. `###SITE:mySetting.categoryPid###`

### Example: {#sitehandling-in-tca-tca-foreign-table-example}

**EXT:my_extension/Configuration/TCA/my_table.php (excerpt)**

```php
// ...
'fieldConfiguration' => [
    'foreign_table_where' => ' AND ({#sys_category}.pid = ###SITE:rootPageId### OR {#sys_category}.pid = ###SITE:mySetting.categoryPid###) ORDER BY sys_category.title ASC',
],
// ...
```
