Skip to content

{$smarty.capture.$somevar} no longer works #478

Closed
@ymTm7KuhCnIjkZAl2x2m2

Description

@ymTm7KuhCnIjkZAl2x2m2

The following code and output should display the issue.

Template:

Smarty: {$smarty.version|escape}
<br />
PHP: {$phpversion}
<br />
{capture name=FooBar assign=FooBar}I am the foobar{/capture} 
{assign txt 'FooBar'} 
1: {$smarty.capture.FooBar}<br />
2: {$smarty.capture.$txt}<br />
3: {$smarty.capture[$txt]}<br />
4: {$txt}<br />
<!-- just in case it's caps lock related --> 
{capture name=baz assign=baz}I am the baz{/capture} 
{assign txt2 'baz'} 
5: {$smarty.capture.baz}<br />
6: {$smarty.capture.$txt2}<br />
7: {$smarty.capture[$txt2]}<br />
8: {$txt2}<br />

Output:

Smarty: 3.1.27 
PHP: 5.6.36 
1: I am the foobar
2: I am the foobar
3: I am the foobar
4: FooBar
5: I am the baz
6: I am the baz
7: I am the baz
8: baz
Smarty: 3.1.33-dev-5 
PHP: 5.6.36 
1: I am the foobar
2: 
3: 
4: FooBar
5: I am the baz
6: 
7: 
8: baz

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions