Typo3: How can i set common data in header and footer like logo?

1k views Asked by At

I want to set a dynamic logo for mobile and desktop versions in header footer. I want to set an email, phone number and address in the footer. how can I set all data in one place? Should I store every page of all data?

2

There are 2 answers

3
Geee On BEST ANSWER

Constant is basically for a general setting, you can create in your base template. However, sitepackagebuilder provides minimal setting.

It's pretty easy! You can create your own constant with simple code below:

  1. Create constant, Add constant in your constant.ts (Generally file path is ext/yourExt/Configuration/TypoScript)

    plugin.tx_yourplugin {
       settings {
           # cat=plugin.tx_yourplugin/file; type=string; label=Website Logo
           siteLogo =
       }
    }
    

Now, you will find constant in your TYPO3 backend template->constant Editor module, within your extension constants.

  1. Assign a value to setup.ts: Add below code in your setup.ts which is located in the same directory.

    plugin.tx_yourplugin {
        settings {
           siteLogo = {$plugin.tx_yourplugin.settings.siteLogo}
        }
    }
    

Now, your dynamic value from constant can be accessible to your fluid template or your extbase controller. You will find your constant in the settings user below debug.

<f:debug>{_all}</f:debug>

Here is some useful link:

As far as I know, a multiline constant and type file is not yet supported.

I hope this helps!

3
phvt On

Check out Bootstrap Package (https://extensions.typo3.org/extension/bootstrap_package/), a popular, ready-to-use TYPO3 extension that provides a responsive theme for TYPO3. With it, you can easily customize the header and footer across all pages. As the extension's name implies, it makes extensive use of the Bootstrap framework.