As I’m sure you’ve discovered by now, the Extranet Framework provides a rich set of intrinsic objects and APIs that you can use to truly customize your site. One method I want to highlight today is sch.appendHTML().
This method is used to insert a returned string into the HTML stream. It’s the preferred method to return HTML markup that is generated by script. When generating large amounts of returned HTML, adding the markup using appendHTML outperforms building up the entire string within the script an returning it all at once.
So that’s the official use of the method. Another use is as a debugging tool. We’re all familiar with the wom.log() method to write information to the WOM Log and it’s incredibly useful when developing and debugging to write out current state and trace logs. When working with the generation of presentation, however, I find it more convenient to use sch.appendHTML(). It can be used as an alternative to wom.log() with some added benefits:
- The detail written out is immediately visible in the rendered page. This avoids the extra step of locating and opening the current WOM Log file to see your debugging output.
- Debugging statements are included in the rendered page inline with everything else. This means that your debugging information appears in the page in the midst of all the real markup, allowing you to trace your code in the context of everything else.
Everyone’s development approach is a bit different and this is only one technique. It’s both simple and effective, so it’s a well used tool in my toolbox. You can learn more about this method and many others in the Workflow Developer’s Guide found on ClickCommerce.com.
Cheers!
No comments:
Post a Comment