Roundcube Community Forum

Miscellaneous => Roundcube Discussion => Topic started by: mats on November 10, 2024, 07:07:44 AM

Title: use variable in roundcube variable
Post by: mats on November 10, 2024, 07:07:44 AM
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?
Title: Re: use variable in roundcube variable
Post by: alec on November 11, 2024, 03:04:47 AM
<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.
Title: Re: use variable in roundcube variable
Post by: mats on November 11, 2024, 11:06:54 AM
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