Skip to content

Capture append as item in associative array #538

Closed
@vbezruchkin

Description

@vbezruchkin

Hello,

This task is very close to #366. But the previous solution does not fit the idea.

Let me explain in details.

I have one array and it's available in Smarty:
$arr = array('first' => 'One', 'second' => 'Two');

I want to extend this array with more items using capture:

{capture name='third' append='arr'}
Three
{/capture}

{capture name='fourth' append='arr'}
Four
{/capture}

As a result I would like to have array like this:
$arr = array('first' => 'One', 'second' => 'Two', 'third' => 'Three', 'fourth' => 'Four');

At the moment, capture does not allow to do this, as it does not pass any keys to the array during append. I know I can use $smarty.capture.third, etc. anyhow it's not the option for me right now.

Let me know if we can hack somehow the system, to get the results we expect.

Thanks

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