Orchard Hungary is an archive

This site is now an archive. We'll keep it so the content is accessible, but we won't update it anymore. However, we frequently publish Orchard-related news on our other site Orchard Dojo, so be sure to check that out instead. And if you're interested in news about our Orchard development company, Lombiq, check out our website.

Contents tagged with JavaScript

  • Making sure your inline script is only included once when multiple content items are listed

    Tags: development, JavaScript

    It's a common scenario that you want to add a little piece of javascript to enrich your content part. You may find that putting it into a separate script file is an overkill or - because the script needs many parameters from the part's template - too complex. Thus, you go  with an inline script. Good choice! But did you know that if multiple content items having your part are displayed on the same page your script will be injected to the markup multiple times? That ain't good, but there's a simple workaround.

    < More >

  • The event-extensible JavaScript (jQuery) pattern

    Tags: pattern, jQuery, JavaScript, events, Orchard, extensibility

    In JavaScript we can employ the same basic principle mentioned earlier at the end of the dynamic page pattern post. That means, events (in the previous post: Orchard events, here: jQuery events and event handlers) are a great tool when you want to provide some dynamically, independently extensible frame for others to hook into. The framework just calls into the event methods, and "listening" codes simply get the message, without some explicit registration or upfront configuration. Today we'll see how easy it is to write extensible JavaScript code with jQuery events. (I'll make reference to the Orchard resource handling mechanism, but the principle is usable outsides Orchard too.)

    < More >