Jump to content

Advert inside first post instead of after


marklcfc

Recommended Posts

Posted

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

Posted

That almost works perfect, but I'd like it to appear on the first post of each page. If I use that code it only works on the first post on the first page, not every page.

Posted
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.

Posted
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.

Posted
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:

Posted
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

Posted
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

 

  • 1 month later...
Posted

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}?

  • 2 months later...
Posted

It looks like that some user see the ad in every post of the page. I can't reproduce it on my systems but I saw the screenshots of them.

Maybe $_REQUEST isn't transferred to the next post for all people.

Does anybody else have this issue?

Posted

BTW, is there any other parameter besides "data-excludequote" because the empty area is being shown immediately after having sent a new post? Ajax puts it to the end and shows an empty area. Only reloading the page removes it.

Archived

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

  • Recently Browsing   0 members

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