Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Variable Concatenation in volt

How Can I concatenate variable in volt?

I want to create HTML option list using foreach and put that inside one variable and want to use that variable n number of time on same page

edited Feb '15

try this

{{ [1, 2, 3]|join(' | ') }}


1 | 2 | 3

Also try this

{{ 1 " join with " 2 " join with " 3}}


1 join with 2 join with 3


Join with " [anything you want to join with] "



I want to create HTML option list

do you mean within a volt view, you want to create a variable that contain a full html option list ?

with Phalcon\Tag they are many helpers for building forms:

{{ select("type", productTypes, 'using': ['id', 'name']) }}

Or better

//in controller
$productTypes = array(
            "N" => "Brand New",
            "G" => "Good conditions",
            "U" => "Used",
            "D" => "Unuseable"
$this->view->setVar("producTypes", $productTypes);

// in view
{{ selectSatatic("status", productTypes }}