Can i add external script to template node?

#1

Hi everyone! as the title suggest, i'm trying (well, i haven't tryed yet, because i don't know how) to add an external script to the template node, should i put the .js in a special folder of the server?

i'll leave you the code that i'm using. All the data is coming from a SQLite database from a previous node (i won't append that node because i would have to give you the db)

https://pastebin.com/10yQ5piN

Thanks for reading, very grateful!

0 Likes

#2

Regular template or ui_template?

If it is a ui_template, you could try having a file-in node read the script, stick it in msg.template and pass that to the ui_template and set the ui_template 'Template type' to 'Added to site section.

0 Likes

#3

it's ui_template, i'll try that!

0 Likes

#4

should it work if i just copy all the "text" of the .js file and paste it on my script?

0 Likes

#5

Depends on what the script does :grin:
Did you try

0 Likes

#6

Yes, i tried. I copied all the text from that .js and pasted it on one ui_dashboard and selected the "add to the head section" option, and it worked just fine. Althought there were some functions that i can't make them to work, i'll investigate a little more.

Thanks!

1 Like