Say hello to the “dynamic module injector”

This is a guest post from Nick Balestra, CEO and Co-Founder of Beyounic, home of the Ohanah events manager for Joomla.

It has been said many times before, Nooku is not a one-way street. The Nooku community thrives on collaboration. At Beyounic we believe in this and decided to organise a hackathon at our own Beyounic HQ in Locarno Switzerland. We brought our team together and flew Johan in to hack for two full days on Nooku Framework. One of the little gems that came out of this is the ‘dynamic module injector’.

In Joomla, modules are attached to a menu item based on its ID. If you want to associate a specific module with a specific page you need to create a menu item for that page, then link the module to it. While this may work in many cases, it’s not always ideal.

Real world scenario

Let me explain this with a real world scenario and how we are using this in Ohanah.

Let’s assume you want to publish a list of upcoming events for a specific category on the main menu of your website. When a user click on an event you want to display the event page, together with the attendees list module in the left module position.

Without the dynamic module injector you would need to develop a module that shows the list, install it, create an instance of it and then assign it to the menu item that links to your events page.

With the dynamic module injector you don’t need a module, you just add the following code to the single event view template:

<module title=”Attendees” position=”left”>attendee list code goes here</module>

This results in the list of attendees being dynamically generated and rendered as a module attached to the event view and injected in the module position left with the module title “Attendees”. All without having to set up a module and publish it, or having to worry about menu items, conflicts during navigation, etc. Neat huh !

Here is the dynamic module injector in action in Ohanah (live demo).

Dynamic Module Injector

Ready, set, code

For the developers among you, we posted the template filter on GitHub: https://gist.github.com/1131081 so you can already make use of it. The code has been contributed back and is integrated in the Nooku Framework development branch at the moment. It will be released in Alpha 4, see ticket #150.

Happy coding!

  • http://twitter.com/ollej Olle ☃ Johansson

    This is really neat! Couldn’t this be done as a plugin, so that it would be possible to enter the module tag in any content?

  • http://twitter.com/sanjeevshrestha sanjeevshrestha

    Nice!!

  • http://johan.janssens.me Johan Janssens

    Very similar concept, our dynamic module injector works on a template level it’s not a content plugin. You could say that Shooter is for content editors and what we do is for designers and developers.

  • http://johan.janssens.me Johan Janssens

    It could be and that’s exactly what Arno has already done. See : http://originin.com/shooter

  • http://twitter.com/ajmalafif ajmal afif

    wow this is revolutionary. Can’t get any simpler than that.

    Nooku has been impressive and from facts and figures, definitely something one should consider given its efficiency (the above is one example of em) and purpose (more effective system of doing multi-language sites etc.)

    However on a different note, taking a step back and looking from my perspective, I have been following Nooku news for awhile now but I don’t see myself fit in the picture or crowd though. It looks like it revolves around developers and at least designers, and make a website owner/admin, or marketer like myself, felt left out or awkward. The most I could do to show support or getting involved is retweet any big news or development updates, and that basically it.

    I hope those who read this understand my point the way I mean it. It is not about pointing fingers blaming, accusing or getting jealous towards a group of elites having fun in their own party. But rather something like, I want to join in and contribute my part if there is anything I could do, but from “outside” it looks like it’s a “closed” open-source party.

    It could be it’s too early for groups that aren’t developers or designers to join or contribute, since everything is on Alpha built right now.

    Enlighten me if I am lost or not making any sense, or perhaps such “restriction” is intended. It could be I have been knocking on the wrong door all these while.

  • http://johan.janssens.me Johan Janssens

    Enjoy your holiday ! Lot’s of cool stuff happening in Nooku Server, have a look and let us know what you think. Maybe it’s time to plan for another Nooku Jam in the Netherlands ?

  • http://johan.janssens.me Johan Janssens

    Hi Ajmal ! Thanks for being so candid. Nooku is focussed on bringing developers together to innovate, collaborate and evolve Joomla. This is not a restriction, more a clear focus.

  • http://twitter.com/ajmalafif ajmal afif

     Hi Johan, Thanks for the reply. I see, perhaps it’s still too early for non-developers to jump in and contribute something major for now I guess.

    It’s cool though. Either that or sometimes I think just become a developer and join in :p

  • http://johan.janssens.me Johan Janssens

    That”s offcourse also an option. Learn to program and contribute code.

  • Arno

    Let’s look at that after the vacation, Friesland could use some coding jam :-)

  • http://blog.nooku.org/2011/10/nooku-0-7-alpha-4-released/ Nooku 0.7 Alpha 4 released « Nooku Blog

    [...] the biggest impact. Nooku Framework Alpha 4 packs two little gems that could just do that. The ‘Dynamic module injector’ and the ‘Transparent Module [...]

blog comments powered by Disqus