We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

how to combine volt variable and php variable in volt?

in volt template file:

some operate need to use php process, but i don't know how to transfer volt var to php?

such as:

$.ajax({
    url: "<?php echo $this->url->get("cities/get/".{{items.id}}) ?>"
})
.done(function() {
    alert("Done!");
});
</script>


5.5k
Accepted
answer

This should work: <?php echo $this->url->get("cities/get/".$items->id ) ?>



17.8k

@rvanderfeer, you are right. i tested it .

thank you