Hi Koen! On Wed, May 18, 2016 at 1:28 AM, Koen Deforche <k...@emweb.be> wrote: > Hey, > > 2016-05-17 23:05 GMT+02:00 K. Frank <kfrank2...@gmail.com>: >> >> Hello List! >> >> How might I approach mixing Wt with non-Wt web programming? >> ... >> Suppose I want to add some "active" content to it -- some Wt >> widgets -- but still want to leave the bulk of the web site as >> plain html / css. Is there a straightforward was to embed some >> Wt content into an html page and have it "play nice"? > > Wt has a so-called 'widget set' mode that is exactly that: it allows you to > embed a few Wt widgets in a different page (possibly hosted on a different > domain). In this case the application is imported inside this page as a > script. There is a feature/widgetset example that illustrates the technique. > It's also used on the homepage: the 'chat widget' is actually a second Wt > application which is embedded in the first. See also this blog post on this > topic: > > https://www.webtoolkit.eu/wt/blog/2010/12/17/widgetset_mode_and_cross_origin_requests
Thank you. I have added: <div id="chat"></div> <script src="http://www.webtoolkit.eu/wt/examples/simplechat/chat.js?div=chat"> </script> from the above blog post to a trivial html web page, and it does seem to work. (I have a question about chat.js that I will ask in a separate post.) >> Conversely, let's say I have a Wt-based web site, but want to >> add significant document-style static content to it, and I want >> to author and maintain the document content as html (and, >> furthermore, I don't want to compile the html into a Wt application >> or resource bundle). Is there a straightforward way to embed >> html content -- perhaps even multiple pages -- into Wt? > > This is a bit harder: there are several approaches: > - read the HTML/CSS in a specialized WTemplate/WText which then renders it > inside your application as a widget Just to be sure I understand: Could this be as simple as reading in a well-formed html file (say, content.html, although the actual file name / extension is irrelevant -- could equally well be content.xyz), for example, using in c++ an ifstream, and using the entire contents of the file as the argument to WText::setText()? > - serve the static HTML/CSS alongside the Wt application as a raw HTML > pages (using a static resource). For one customer we followed this approach. I think I've done this in some of my toy experiments, having links in a Wt app link to static html files, and having links in the files link back to the Wt app. (But I'm not really sure ... I'm still confused by how the urls, internal urls, path names, and docroot all interact.) But what do you mean by a "static resource"? > The main challenge is to make sure that links and secondary resources are > pulled in correctly. That again depends on how they look like, etc... > >> And let's say we do either one or both of the above. Would it >> be practical to style both the Wt and free-standing html parts >> of the web site with the same css? > > For the widget set application, and the template approaches, that's > automatically the case. Okay. > For static HTML/CSS alongside this won't be the case. Okay, that seems reasonable. > Regards, > koen Thanks for your explanations. Best. K. Frank ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest