We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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.

Volt - using a variable in stylesheet_link argument (SOLVED)

I'm passing an assets_base_url variable to my view.

The following works for loading a stylesheet.

<link rel="stylesheet" href="{{ assets_base_url }}css/app.css">

However, I was wondering if it was possible to use that variable within the stylesheet_link method to output the entire tag. I tried it this way, but it doesn't work.

{{ stylesheet_link( assets_base_url . 'css/app.css') }}

edited Mar '14

To concat strings use '~'.

{{ stylesheet_link( assets_base_url ~ 'css/app.css') }}

Also you could use static urls (http://docs.phalcon.io/en/latest/reference/url.html#static-vs-dynamic-uris)


Static urls! That's perfect. I can't believe I missed that when reading the docs.

Thanks bro!