I’ve updated jc_include to now also support including files from compiled LassoApps. The reason jc_include exists is because it, in contrast to Lassos regular include_file, allows you to send local variables to the include and have them accessible inside the include Here are some examples on how it can look:
This has always been possible since the original implementation:
With the new version you can call files that are part of a compiled LassoApp. The construct of the Lasso specific code inside the included LassoApp file differs depending on if you call it as lasso extension or html. The html is easiest. First the lasso extension version: jc_include( lassoapp_include('/myapp/mytest', 'lasso'), '/myapp/mytest.lasso', -title = 'Hello World', -content = 'Here be content’ )
The include file needs to use  syntax for any code that’s to be processed after the include and start with a [no_square_brackets]. Any Lasso code inside Lassoscript syntax, as in <?LassoScript code ?> will be processed before the file is included and not have access to the provided params.
Personally I prefer this way: jc_include( lassoapp_include('/myapp/mytest', 'html'), '/myapp/mytest.html', -title = 'Hello World', -content = 'Here be content’ )
Content of mytest.html can in fact be anything and not contain any html at all. Including it as a html file is only a directive to Lasso to not preprocess any of the content and instead send it raw to jc_include. <!DOCTYPE html> <html lang="en"> <head> <title>[#title]</title> </head> <body> [#content] </body> </html>
I use jc_include a lot and find it very convenient. It makes it possible to skip vars entirely and instead use locals. Giving much better control over your dynamic content. The main use for me is of course to include html templates at the end of processing a request.
You can find the latest incarnation at https://gist.github.com/jolle-c/95847fcd568d63d09aed
While there, take the opportunity to check out some of the other gists I have published. Most of them are very useful. :-)
This message is sent to you because you are subscribed to the mailing list Lasso Lasso@lists.lassosoft.com Official list archives available at http://www.lassotalk.com To unsubscribe, E-mail to: <Lassoemail@example.com> Send administrative queries to <Lassofirstname.lastname@example.org>
Jolle Carlestam Re: jc_include now supports LassoApps
Nov 18, 2015; 10:02
Re: jc_include now supports LassoApps
No keywords defined. Log in to define appropriate keywords
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!