Jump to content

IPS 4.1 : ADVERTISEMENT inside the first post


Recommended Posts

This is working well - thanks for all the help @Upgradeovec 

I ended up struggling to get the ad block to float to the right of the post content like i wanted it to - so that it isn't above or below the post text (unless on a small screen).

float:right; didn't seem to work like it should, so I ended up w/ the below code which is the closest I could get to what I want.

Please share if anyone has a better way of doing this.

my code:

<!-- adsense ad code in first post start -->
{{if (($comment->position - 1) % \IPS\Settings::i()->forums_posts_per_page === 0)}}
<div   style="display:inline-block;float:right; max-width:336px;">
<ins class="adsbygoogle"
     style="display:inline-block;width:336px;height:280px"
     data-ad-client="ca-pub-00000000000"
     data-ad-slot="00000000000"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
          
<div style="display:inline-block;max-width:50%;">
{{endif}}
  
<!-- this is the post content -->
			{$comment->content()|raw}
			{{if $comment->editLine()}}
				{$comment->editLine()|raw}
			{{endif}}
  
{{if (($comment->position - 1) % \IPS\Settings::i()->forums_posts_per_page === 0)}}
 </div>
{{endif}}    
<!-- adsense ad code in first post end -->

 

Thanks

 

Link to comment
Share on other sites

  • 2 years later...

Hey  @Numbered

Looks like we need your help here again... Of course if you have time....

we used to find this line on template>forums>front>topics>topic

					{{$postCount++;}}

and add this below that

         			{{$page = (\IPS\Request::i()->page ? (\IPS\Request::i()->page - 1) * \IPS\Settings::i()->forums_posts_per_page : 0); }}
					{{$comment->position = $page + $postCount;}}

First question: Is above code still correct???? compatible with version 4.5???

THEN

Open this template>forums>front>topics>post  and find this

		<div data-role='commentContent' class='ipsType_normal ipsType_richText ipsPadding_bottom ipsContained' data-controller='core.front.core.lightboxedImages'>

add this below that line

          {{if (($comment->position - 1) % \IPS\Settings::i()->forums_posts_per_page === 0) || (($comment->position - 1) % 15 === 0)}}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="clint-code"
     data-ad-slot="5827740529"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{{endif}}

Is the second part code is still correct??? compatible with 4.5???

 

Thank you for your help 🙂

 

Link to comment
Share on other sites

Hi @media. I don't know. But it seems that old logic should work. Just try them on the staging instance. I didn't upgrade our IPS instances to 4.5 because focused on developing other web services for us and the IPS upgrading process with all apps, themes, and plugins isn't cheap by the time.

Link to comment
Share on other sites

On 10/22/2020 at 2:00 AM, Numbered said:

Hi @media. I don't know. But it seems that old logic should work. Just try them on the staging instance. I didn't upgrade our IPS instances to 4.5 because focused on developing other web services for us and the IPS upgrading process with all apps, themes, and plugins isn't cheap by the time.

Thank you and good luck with your other project...

Anyone else? can help us to check above codes for usability on IPB version 4.5.4???

Link to comment
Share on other sites

  • 8 months later...
On 10/21/2020 at 9:34 PM, media said:

Hey  @Numbered

Looks like we need your help here again... Of course if you have time....

we used to find this line on template>forums>front>topics>topic

					{{$postCount++;}}

and add this below that

         			{{$page = (\IPS\Request::i()->page ? (\IPS\Request::i()->page - 1) * \IPS\Settings::i()->forums_posts_per_page : 0); }}
					{{$comment->position = $page + $postCount;}}

First question: Is above code still correct???? compatible with version 4.5???

THEN

Open this template>forums>front>topics>post  and find this

		<div data-role='commentContent' class='ipsType_normal ipsType_richText ipsPadding_bottom ipsContained' data-controller='core.front.core.lightboxedImages'>

add this below that line

          {{if (($comment->position - 1) % \IPS\Settings::i()->forums_posts_per_page === 0) || (($comment->position - 1) % 15 === 0)}}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- responsive1 -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="clint-code"
     data-ad-slot="5827740529"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
{{endif}}

Is the second part code is still correct??? compatible with 4.5???

 

Thank you for your help 🙂

 

Hi everyone, 

Can someone look at this above code and let us know if it works on IPB 4.6.2????

Greatly apricated your help

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...