Hop Inject

Current Version: 3.0.0
  • Installation

    1. Unzip the folder to a temporary location on your local hard drive.
    2. FTP the following files from their local folders to the same locations in your EE install’s /third_party folder on the server:

  • Usage

    1. Wrap the content to be processed in the {exp:hop_inject} template tag.
      {exp:hop_inject where="<p>" always_inject="yes"}
           Content into which you want to inject other elements.
      • The where parameter gets a string that determines where an injection might occur, as determined by use of the {exp:hop_inject:injection} tag (See step 2).
      • The always_inject parameter determines what happens to injections that are outside the bounds of the content. For example, if you specify an injection at the tenth paragraph tag, but there are only seven paragraphs, what should happen to that injection?

        If always_inject=“yes”, then the injection will simply appear after the entire block of content. If it’s no, the block will be ignored. yes is the default value.

        Bonus: A negative number like -1000 puts the injected text appear before the entire block of content.
    2. Wrap each element you want to inject with {exp:hop_inject:injection} tags.

      {exp:hop_inject:injection separator="1" position="before"}
           Element to inject.

      Use multiple {exp:hop_inject:injection} for each element to be injected.

      • The separator parameter is very flexible. It represents the count of the element that’ll get the injection.

        You can clone content this way, too, by injecting it multiple times: separator=“3|6|9”

        Using a negative number for the separator counts up from the bottom.  For example, separator=”-4” injects the element at the fourth separator occurence from the bottom.
      • The position parameter is either before or after.  By default, the injection will be made before the separator.

  • Example

    {exp:hop_inject where="

    " always_inject="yes"} {exp:hop_inject:injection separator="1" position="after"} Put this text after the first paragraph tag. {/exp:hop_inject:injection} {exp:hop_inject:injection separator="8" position="before"} Put this text before the eighth paragraph tag (in the 8th paragraph). {/exp:hop_inject:injection} {exp:hop_inject:injection separator="2|3" position="after"} Put this text after the second AND third paragraph tags. {/exp:hop_inject:injection} {exp:hop_inject:injection separator="8"} Put this text before the eighth paragraph tag, too. {/exp:hop_inject:injection} {exp:hop_inject:injection separator="-4" position="after"} Put this text after the 4th paragraph tag counting from the end. {/exp:hop_inject:injection} {exp:hop_inject:injection separator="300"} Because of the large number, this text will appear after the entire content block. {/exp:hop_inject:injection}










  • Updating

    Updating is easy:

    1. Download a new version from this Web site, and extract on your hard drive.
    2. Upload the new files to their appropriate locations.

  • Uninstalling

    1. Navigate to the Add-Ons/Modules tab in your EE control panel and uninstall the module.
    2. Remove /hop_inject/pi.hop_inject.php from the server.

  • Version History

    Updated for EE 3
    Fixed a case where always_inject was set to 'yes' but there were no instances of the thing at all to find. Other cleanup, too.
    Ah edge cases. Fixed a case where the number of paragraphs was just one short, but always_inject was set to 'n'
    Fixed the 'always_inject' parameter and got rid of two PHP notices.
    Bug fix release for compatibility with EE 2.1.3 (Thanks owed to Michelle of
    Initial release for EE 2.x, Includes version 1.2.0 for EE 1.6.x
    Added ability to count from bottom, not just from top, Improved documentation
    Code Cleanup
    Initial Release

Have a Project for Us?

Get in Touch