Skip to content

Concatenating variables in attributes #37

@Edo78

Description

@Edo78

Hi,
maybe I'm doing something wrong but if I try to compile this

each related in ['a', 'b']
    img(class="bottle_"+related+".jpg", src="bottle_"+related+".jpg")

I get

<?php
if (array(
    'a',
    'b'
)):
    foreach (array(
        'a',
        'b'
    ) as $related):
        $■['related'] = $related;
?><img src="bottle_"+related+".jpg"<?php
        attr_class(add("bottle_", $related, ".jpg"));
?>/><?php
    endforeach;
endif;
?>

As you can see class and srcare compiled with different values ...
Right now I use an ugly workaround declaring variable for every concatenation I need eg. - var bottle="bottle_"+related+".jgp"but this is way far from ideal

Is it a bug or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions