Documentation · ViewHelper reference

XSD schema file | vhs master

Variable / TyposcriptViewHelper

Variable: TypoScript

Accesses Typoscript paths. Contrary to the Fluid-native f:cObject this ViewHelper does not render objects but rather retrieves the values. For example, if you retrieve a TypoScript path to a TMENU object you will receive the array of TypoScript defining the menu - not the rendered menu HTML.

A great example of how to use this ViewHelper is to very quickly migrate a TypoScript-menu-based site (for example currently running TemplaVoila + TMENU-objects) to a Fluid ViewHelper menu based on v:page.menu or v:page.breadCrumb by accessing key configuration options such as entryLevel and even various wrap definitions.

A quick example of how to parse a wrap TypoScript setting into two variables usable for a menu item:

<!-- This piece to be added as far up as possible in order to prevent multiple executions -->
<v:variable.set name="menuSettings" value="{v:variable.typoscript(path: 'lib.menu.main.stdWrap')}" />
<v:variable.set name="wrap" value="{menuSettings.wrap -> v:iterator.explode(glue: '|')}" />

<!-- This in the loop which renders the menu (see "VHS: manual menu rendering" in FAQ): -->
{wrap.0}{menuItem.title}{wrap.1}

<!-- An additional example to demonstrate very compact conditions which prevent wraps from being displayed -->
{wrap.0 -> f:if(condition: settings.wrapBefore)}{menuItem.title}{wrap.1 -> f:if(condition: settings.wrapAfter)}

/

  • Tag usage example

    <v:variable.typoscript path="NULL">
    	<!-- tag content - may be ignored! -->
    </v:variable.typoscript>
  • Inline usage example

    {v:variable.typoscript(path: 'NULL')}

Arguments

Argument Description Type
path

Path to TypoScript value or configuration array

string
Required attribute

Revision history

commit da7677bc74f14e9a9300e4ba4487e52c3cb97642
Author: Claus Due <*****@namelesscoder.net>
Date:   Sun Apr 20 01:13:33 2014 +0200

    [TASK] Switch to namespaces

commit f16494865266f00f4df185236b7856aa96841039
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sat Jun 7 22:58:04 2014 +0200

    [TASK] Replace old namespace and move v:if to v:condition and v:var to v:variable in documentaion and readme

commit 53b0c30204bc1f46f2b2c6cb13c33c49d6c39f3e
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jun 8 14:42:09 2014 +0200

    [TASK] Update vhs 2.0 namespaces
    Variable in variable PHP

commit 12ff0ddfb8d36c51f2d3befde7ae812177c80d5d
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Wed Jun 11 00:01:47 2014 +0200

    [TASK] CGL remove use leading backslash
    PHP Docs
    Note that for namespaced names (fully qualified namespace names containing namespace separator, such as Foo\Bar as opposed to global names that do not, such as FooBar),
    the leading backslash is unnecessary and not recommended, as import names must be fully qualified, and are not processed relative to the current namespace.

commit 716b251b6470782dbc09ca6e883b00cb75e5e440
Author: Claus Due <*****@namelesscoder.net>
Date:   Thu Jan 15 04:52:28 2015 +0100

    [TASK] More test ports

commit 8bb2fc5ee124ba19b0a0ab8e061c9a153fc4651f
Author: Xaver Maierhofer <*****@xwissen.info>
Date:   Sun Jan 18 17:56:13 2015 +0100

    [TASK] Reference Copyright to license.md file

commit 6ea36a9e15dfa22c248fe20a565ea4e9220fad68
Author: Claus Due <*****@namelesscoder.net>
Date:   Mon Jan 26 00:45:38 2015 +0100

    [TASK] Switch a simple condition to a ternary expression