Using settings for an url

Hey there,

i want to use a “setting” for an url.

In fact i try to implement the setting (i defined as a string config-element) for this line:

<div class="icon on"><svg viewBox="0 0 48 48"><use xlink:href="/static/matrix-theme/squidink.svg#thermometer-3"></use></svg></div>

I tried it with the following line:
<div class="icon on"><svg viewBox="0 0 48 48"><use xlink:href="{{(config.svg1)}}"></use></svg></div>

But i just get the text of the string displayed in the preview-dialog. I want to hand over the url i defiiened in the svg1 attribut.

Could andybody help me?

You’re going to have to be a lot more specific.

I don’t grasp what you’re trying to accomplish.

I guess he is trying to replace the url to the svg file with a config variable so that the widget is not hardcoded to use a specific file but a config variable.

MrBoggi,

You are right. This is exactly what i want to do.

Do you have any hints for me?

Maybe try one of the two first answers from here:

Hey yannick,
Thanks for replying. I tried the mentioned approach but with no result. The svg is just not shown. Do you have another hint?

Sorry, none that I can think of right now.
I didn’t buy squidink.svg so can’t have a look either.

Well in that case how about something like this?

If you have an item named svg1 that contains the url string:

<div class="icon on"><svg viewBox="0 0 48 48"><use xlink:href="{(itemState('svg1')}"></use></svg></div>

As another angle, is there a browser that will render the external svg using this syntax? I haven’t found one…

<html>
<div class="icon on"><svg viewBox="0 0 48 48"><use xlink:href="m2.svg"></use></svg></div>
</html>