sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Include paths

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 392 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P Offline
      PeeWeeHaa
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        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.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          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's to_s method, 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

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement