Include paths
-
Hi guys,
I am pretty new to Sketchup, RubyScript and webdialogs and i encounter an issue with writing webdialogs. Not sure if this is the correct forum to post, but feel free to correct me...I am writing a webdialog that edits data and i need to include an external css script and library. I can manage that with a relative path using something like
<link rel="stylesheet" href="../../../resources/css/webdialogs.css" />
I would like to include it with an absolute path, something like
<link rel="stylesheet" href="<myroot>/resources/css/webdialogs.css" />
Is there a way to get this root from within the webdialog?
-
BASE element | base object
[https://msdn.microsoft.com/en-us/library/ms535191(v=vs.85).aspx](https://msdn.microsoft.com/en-us/library/ms535191(v)... but it is more normal to have your plugins resources in a sub-directory of your plugin's sub-directory.
-
IN Ruby you can do interpolation in double-quoted strings with the
#{ }operator. The expression between the curlies is evaluated and passed to the result'sto_smethod, then stuffed into the string.So you'd create a string of html:
html = %Q{ <html> <head> <base href="#{myroot}" /> <link rel="stylesheet" href="resources/css/webdialogs.css" /> </head> <body> </body> </html> } my_dialog.set_html(html)You can also use a
HEREDOC.
See: http://ruby-doc.org/core-2.0.0/doc/syntax/literals_rdoc.html
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement