Jump to content

Advert inside first post instead of after


marklcfc

Recommended Posts

Create an advertisement (or advertisements) and set it/them to display in a custom location called inside_first_post (or whatever you want it to be)

Edit your theme, specifically forums -> front -> topics -> post

Locate:

{$comment->content()|raw}

Add above it/below it:

{{if $comment->mapped('first') }}
{advertisement="inside_first_post"}
{{endif}}

Save, refresh, marvel at how easy it actually was to do ;)

It's up to you to handle the finer details of positioning within the post (ie left/right/center/up/down - handle that within the advertisement html code) but there's your starting point above. And observe the problem you introduce by adding this to the first post....it's part of the post, so it will be included in quotes of that post. Probably easy to overcome with placing the additional content in the template outside (ie after the closure) of the 'commentContent' div, but will let you try that out.

Screenshot_7.png

Link to comment
Share on other sites

9 minutes ago, marklcfc said:

That almost works perfect

Works perfect for what you requested, ;) and you're welcome.

You've now got your starting point - the 'first post' in a topic isn't the same as the 'first post on each page of a multi-page topic, so the above isn't going to work as you now want it. Now what you need to do is take the time (just like I did with the above) and think about if it's possible to identify the 'first page on each post of a multi-page topic' in the template.

Link to comment
Share on other sites

Just now, EricT said:

@Nathan Explosion I can recognize one of the coins I have on my forum. It is not a problem at all, but how it is possible ? ^_^

You were asking in a thread on here recently on how to rotate pics - I tried something out, it didn't work, I didn't bother going any further. And it's possible because you provided the url to it in that topic.

Link to comment
Share on other sites

3 hours ago, Nathan Explosion said:

Works perfect for what you requested, ;) and you're welcome.

You've now got your starting point - the 'first post' in a topic isn't the same as the 'first post on each page of a multi-page topic, so the above isn't going to work as you now want it. Now what you need to do is take the time (just like I did with the above) and think about if it's possible to identify the 'first page on each post of a multi-page topic' in the template.

Wouldn't know where to start :unsure:

Link to comment
Share on other sites

2 hours ago, newbie LAC said:

{{if $_REQUEST['ad_inside_first_post'] = !isset($_REQUEST['ad_inside_first_post']) ? 1 : 0}}			
	{advertisement="inside_first_post"}
{{endif}}

 

That is great, however there is an issue. When quoting the post with the advert, it tries to quote the ad (highlighted below). Is it to do with where I place the code? I placed it where Nathan suggested above.

advert quote.png

Link to comment
Share on other sites

14 minutes ago, marklcfc said:

That is great, however there is an issue. When quoting the post with the advert it, it quotes the box (highlighted below). Is it to do with where I place the code? I placed it where Nathan suggested above.

You should to put your code outside div with data-role='commentContent' or add data-excludequote to your ad code. See example here https://invisionpower.com/forums/topic/429838-nb41-enhanced-advertisements/?do=findComment&comment=2641576

 

Link to comment
Share on other sites

  • 1 month later...

This works good, I'm using 

{{if $_REQUEST['ad_inside_first_post'] = !isset($_REQUEST['ad_inside_first_post']) ? 1 : 0}}		
<div style="float:right; position:relative; padding: 0 0 0 5px;" data-excludequote>
    {advertisement="inside_first_post"}
</div>
{{endif}}

Does anyone know how to get it inline and not below the post text in {$comment->content()|raw}?

Link to comment
Share on other sites

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...