Template Injection

Table of Contents:


Overview
aaaahhhha!
  • Overview

    The 'Template Injection' (jrInject module).

    The description for this module is: "
    A small module that allows key/value replacements in the HTML output of the site"


    But what does that mean and why would you want to do it?
  • aaaahhhha!

    The 'Aha!' moment comes when you see this module in action. So to speed that along, here is a screenshot of the Global Settings
  • screenshot of the Global Config tab on the Template Inject (jrInject module).
  • What that is saying is "Take any instance of 'col6' you find and replace it with 'col2'"

    What you end up with is this:
  • screenshot of the front page of the elastic skin after replacement
  • What has happened is that 'col6' which is the way the elastic skin defines that a column should be 6 of the full 12 columns wide has been changed to 'col2' making it only 2 columns wide.

    But why should I care? / Why should that excite me?
    Because it means that if your trying to do something like create a skin based on something else, say the Bootstrap 3.0.3 CSS template from http://getbootstrap.com/ then you don't need to change the way bootstrap works.

    Bootstrap uses the same 12 column layout but has different css class names for 6 col.

    In bootstrap its not the class 'col6' but rather 'col-lg-6' that indicates a 6 col layout.

    so you could use this module to replace:
    col6|col-lg-6

    and you would be ready for bootstrap.
  • Its also a great example of the events and listeners system in action. Take a look at the code.

Share This

Tags