Hop Inject
ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Hop Studios
Not rendering/working properly
General
CompassMedia
|
Posted: 11 April 2013 03:00 PM |
|
|
|
Hey! I am not sure if this is correct or not but the docs don’t explain where you are supposed to place the hop inject code.
I am using an article channel with a basic {body_copy} custom field. No pair tags, just plain. Here is how i set it up after looking at some of the other posts in your thread.
{exp:hop_inject where="<p>" always_inject="yes"} {exp:hop_inject:injection separator="2" position="after"} {if related_links} <div class="related-links"> {related_links} <a href="{link_url}" target="_blank">{link_title}</a> {/related_links} </div> {/if} {/exp:hop_inject:injection} {body_copy} {/exp:hop_inject}
but it looks really funny when it outputs.
Is there something that I am not doing correctly with the set up?
Also I would suggest adding in your docs some more explanation on how to use it with custom fields.
|
|
|
Travis Smith
|
Posted: 11 April 2013 04:43 PM |
# 1
|
|
Developer
|
That looks like it would work fine. That would take the body copy content, and insert a related-links box, if there were related links, after the second paragraph of the body copy
|
|
|
CompassMedia
|
Posted: 11 April 2013 04:49 PM |
# 2
|
|
|
It is working that way. It is making the font change on the paragraph after the injection. Any idea why it would do that? Thanks for confirming that it looks correct. :)
|
|
|
Travis Smith
|
Posted: 11 April 2013 04:51 PM |
# 3
|
|
Developer
|
That would be a CSS issue—maybe the DIV inside the P would be confusing things?
|
|
|
CompassMedia
|
Posted: 09 May 2013 09:57 AM |
# 4
|
|
|
back again! So the injection is working. I am injecting ads using adman to serve the ads after every 4 entries using the </div> as the identifier. It works. It works a bit too well. ;). It seems as if it is taking the exact same code and injecting it each time instead of recognizing the order=“RANDOM” in adman, it injects the same ad over and over again after each 4 entries. Is there a way to make hop inject treat the injection as a separate injection each time - that way the ads would pull randomly within the entries?
|
|
|
CompassMedia
|
Posted: 09 May 2013 10:02 AM |
# 5
|
|
|
{exp:hop_inject where="</div>" always_inject="no"} {exp:hop_inject:injection separator="4|8|12|16|20|24|28|32|36|40|42" position="after"} {embed="lifestyle/ads-mb"} {/exp:hop_inject:injection}
{exp:channel:entries channel="articles|recipes|videos|photo_gallery" limit="12" sort="desc" orderby="date" category="1" paginate="both"} <div class="item"> {if cf_main_image} {cf_main_image limit="1"} <figure><a href="{title_permalink='lifestyle/article'}" title="{title}"><img src="{image:url}" alt="{mf_article_image_alt}"/></a></figure> {/cf_main_image} <article> <h3><a href="{title_permalink='lifestyle/article'}" title="{title}">{exp:trunchtml chars="35" inline="..."}{title}{/exp:trunchtml}</a></h3> <p>{exp:trunchtml chars="50" inline="..."}{sub-title}{/exp:trunchtml}</p> </article> {/if}
{if video_image_placeholder} {video_image_placeholder limit="1"} <figure><a href="{title_permalink='lifestyle/article'}" title="{title}"><img src="{image:url}" alt="{video_image_alt}"/></a></figure> {/video_image_placeholder} <article> <h3><a href="{title_permalink='lifestyle/video'}" title="{title}">{title}</a></h3> <p>{sub-title}</p> </article> {/if} {if recipe_image} {recipe_image limit="1"} <figure><a href="{title_permalink='lifestyle/article'}" title="{title}"><img src="{image:url}" alt="{title}"/></a></figure> {/recipe_image} <article> <h3><a href="{title_permalink='lifestyle/recipe'}" title="{title}">{title}</a></h3> <p>{recipe_sub_title}</p> </article> {/if} </div> {paginate} <span class="paginate"> <p>Page {current_page} of {total_pages} pages {pagination_links}</p> </span> {/paginate} {/exp:channel:entries} {/exp:hop_inject}
Here is the rendered live page. You can see that it injects the ads just fine, but it shows the same ad over and over.
|
|
|
CompassMedia
|
Posted: 09 May 2013 10:03 AM |
# 6
|
|
|
This is the embedded adman code.
{if segment_2 != ""} {exp:adman:show limit="1" group="{segment_2}-MB" order="RANDOM" dynamic="no"} <div class="item"> {if "{is_flash}"} <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="250"> <param name="movie" value="{ad_remote_image}?clickTAG={ad_url}" /> <param name="quality" value="high" /> <embed src="{ad_remote_image}?clickTAG={ad_url}" quality="high" type="application/x-shockwave-flash" width="300" height="250" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> {if:else} <a href="{ad_url}" title="{ad_title}"><img src="{ad_remote_image}" border="0" alt="{ad_alt}" /></a> {/if} </div>
{/exp:adman:show} {if:else} {exp:adman:show limit="1" group="general-MB-box" order="RANDOM" dynamic="no"} <div class="item"> {if "{is_flash}"} <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/ cabs/flash/swflash.cab#version=8,0,0,0" width="300" height="250"> <param name="movie" value="{ad_remote_image}?clickTAG={ad_url}" /> <param name="quality" value="high" /> <embed src="{ad_remote_image}?clickTAG={ad_url}" quality="high" type="application/x-shockwave-flash" width="300" height="250" pluginspage="http://www.macromedia.com/go/getflashplayer" /> </object> {if:else} <a href="{ad_url}" title="{ad_title}"><img src="{ad_remote_image}" border="0" alt="{ad_alt}" /></a> {/if} </div>
{/exp:adman:show} {/if}
|
|
|
Travis Smith
|
Posted: 09 May 2013 10:05 AM |
# 7
|
|
Developer
|
The “Embed” is going to be processed at the very end of the page loading—is that embedded template cached? If so, it’ll cache it the first time and then call the embedded version over and over…
|
|
|
CompassMedia
|
Posted: 09 May 2013 10:12 AM |
# 8
|
|
|
so would you recommend not embedding? I am using Switchee for serious switching of entry channel s and was using the embed so i wouldn’t have to keep copying the code. But if it will solve my injection issue i would be happy to make it a longer page of code.
|
|
|
Travis Smith
|
Posted: 09 May 2013 10:40 AM |
# 9
|
|
Developer
|
I don’t know if you need to embed or not—though I recommend avoiding embedding if possible; lots of overhead. Can you use Snippets instead? There are advantages and disadvantages to each.
TTFN
Travis
|
|
|