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 assetsbaseurl variable to my view.

The following works for loading a stylesheet.

<link rel="stylesheet" href="{{ assetsbaseurl }}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.

{{ stylesheetlink( assetsbase_url . 'css/app.css') }}



269
Accepted
answer
edited Mar '14

To concat strings use '~'.

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

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



1.7k

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

Thanks bro!