Roundcube Community Forum

 

use variable in roundcube variable

Started by mats, November 10, 2024, 07:07:44 AM

Previous topic - Next topic

mats

I'm trying to awoid hardcoding things so doing something like
mybutton.innerHTML = "<roundcube:label name="nonesort">";

seems smart but i vould like to do

var myvar="text";
mybutton.innerHTML = "<roundcube:label name="myvar">"; but that gives me myvar as label on the button, mybutton.innerHTML = "<roundcube:label name=myvar>"; gives [myvar].

Any way to makw this work?

alec

<roundcube> tags are for templates, not client-side. There's rcmail.get_label method, but first you have to "register" the label from your plugin.

Also, instead of innerHTML, use jQuery to change the name attribute.

mats

I should have stated that this is in a template, templates\mail.html to be exact.

It still may no be the best way of doing it but I don't know of a better way of doing it. And yes I'm new to this

instead of having to something like

if string=nonesort then mybutton.innerhtml="<roundcube:label name="nonesort">";
if string=arrival then mybutton.innerhtml="<roundcube:label name="arrival">";
........

I would like to do mybutton.innerhtml="<roundcube:label name=string>";
That is the way I know to make it (human) language independent