We developed Hop Inject to solve a very specific problem: We wanted to place advertisement blocks after the 3rd (or 8th, or 3rd AND 8th) paragraph on a page. But, since this is EE we’re talking about, of course the 3rd (etc.) paragraphs were in a custom field of an entry, and were being rendered dynamically at request time.
Hop Inject does the trick. It lets us specify where an injection should occur (such as, “on paragraph tags”); it lets us specify which of those separators should get the injection (for example, “the third and the eighth”); and it lets us specify what the injection should be. It also lets us choose whether the injection should occur before or after the separator.
Sound like a problem you’ve run into, too? Well, it’s not a problem anymore!
You can download Hop Inject here.
Let us know how you like it!
Justin
Awesome - I was literally just walking home thinking how am I gonna solve a particular problem in an upcoming job - this sounds perfect.
what I was trying to do was provide a single content field (with WYSIWYG editor no doubt) that will be used to display album reviews. The tricky part was they were to fit in a fixed height space on the page, so I was planning on using a jQuery carousel to essentially paginate these reviews up into several carousel slides.
So the tricky bit was being able to tell jQuery / DOM where to cut each page up at - if this does what I think it does, I would presumably be able to specify that on page break tags <’br> it inject the code needed to end one slide and open another. Then its just up to the reviewer to put those breaks in and you’ve got easy, self controlled pagination for a jQuery carousel.
Really hoping its gonna work!!
I’m looking to insert a formatted “more” link just inside the last paragraph at the end of the last paragraph in a custom field before the closing tag, like:
A first paragraph
Possibly a second paragraph
The last paragraph <span class="this_is_the_part_I_want_to_inject"><a href="#">more</a></span>Is this doable?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.