Jump to content

(NB41) Enhanced Advertisements


Recommended Posts

Posted
{{if request.controller == 'search' and !isset(request.q)}}
<div class="cSearchAd">Advert 1</div>
<style>
.cSearchAd, div[data-controller="core.front.search.main"] {
	display: table-cell;
}
.cSearchAd {
	float: right;
	border: 3px solid red;
	height: 600px;
	width: 300px;
	margin: 0 10px;
}
</style>
{{endif}}

and 

{{if request.controller == 'search' and isset(request.q) and request.q == 'adv'}}
<div class="cSearchAd">Advert 2</div>
<style>
.cSearchAd, div[data-controller="core.front.search.main"] {
	display: table-cell;
}
.cSearchAd {
	float: right;
	border: 3px solid red;
	height: 600px;
	width: 300px;
	margin: 0 10px;
}
</style>
{{endif}}

Selector

div[data-controller="core.front.search.main"]

Position 

Insert advert before the chosen element(s)

 

  • 1 month later...
Posted
On 4/14/2017 at 8:12 AM, newbie LAC said:

Hello,

CSS selector 


#elSearch_main [data-role="resultsContents"] .ipsStreamItem:eq(1)

Position 


Insert advert after the chosen element(s)

 

Hello ! 

what would be the same for showing a banner after the 5th unread topic ?  (in the unread list)

in this url link ? https://invisioncommunity.com/discover/unread/

 

[I must say NewbieLac is amazing, he has just helped me put a floating/sticky   ad to specific forums only !   super application ] 

  • 2 weeks later...
Posted
11 minutes ago, Hugo_S4 said:

Hello. Please help. How to insert an ad after the tenth topic in this view https://invisioncommunity.com/forums/forum/238-development-assistance/ Thank you and best regards :thumbsup:

Hello,

CSS selector 

[data-pageapp="forums"][data-pagemodule="forums"][data-pagecontroller="forums"] .cTopicList .ipsDataItem:eq(9)

Position 

Insert advert after the chosen element(s)

 

Posted (edited)

I am posting instructions I got from newbie LAC that i have already implemented!  

Here are the selectors for the  streams

that involve all new posts or new posts from followed or content you have posted in,  i.e. what is in there 

image.png.0c5bd04e89ddae6562459d15e1cf449e.png

 

discover/unread/

[data-streamid="1"] [data-role="streamContent"] .ipsStreamItem:eq(4)

discover/content-started/

[data-streamid="2"] [data-role="streamContent"] .ipsStreamItem:eq(4)

discover/followed-content/

[data-streamid="3"] [data-role="streamContent"] .ipsStreamItem:eq(4)

discover/content-posted/

[data-streamid="5"] [data-role="streamContent"] .ipsStreamItem:eq(4)

Here is the instructions to Add a STICKY POP UP   to SPECIFIC  forum ids  (the banner will stay put when you scroll)

when you press X it will go away. 

image.thumb.png.4e5573561d3494ba1049903b571ab248.png

1)   This you put into your Custom.css file 

.avbxouter {
    z-index: 2;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    width: 100%;
    margin-bottom: 0%;
}
.avbxouter:hover {}.avbxmain {
    border: 0px solid #fff;
    height: auto;
    margin: 0 auto;
    display: table;
    position: relative;
    background: none;
}
#close {
    display: inline-block;
    margin: -15px -25px 0px 0px;
    opacity: 1.0;
    cursor: pointer;
    z-index: 1;
}
#close:hover {
    opacity: 0.95
}
#close {
    display: inline-block;
    margin: -15px -25px 0px 0px;
    opacity: 1.0;
    cursor: pointer;
    z-index: 1;
    position: absolute;
}
Edited by MeMaBlue
Posted (edited)

2) then    open a new advertisement in the forums inbuilt system and 

ad this      into the first box 

you need to ADD 2 THINGS : 

a) the link url of the image that will have the close button X 

b) your ad code

{{if !isset(cookie.nbEnhAdsHeaderBanner)}}
	<script>
	$(function() {
		$( "#nbEnhAdsHeaderBanner" ).on( "click", ".nbEnhAdsHeaderBannerClose", function() {
			ips.utils.anim.go( "fadeOut", $( "#nbEnhAdsHeaderBanner" ) );
			
			var nbEnhAdvDate = new Date();
			nbEnhAdvDate.setTime(nbEnhAdvDate.getTime() + 50 * 60 * 1000);
			ips.utils.cookie.set('nbEnhAdsHeaderBanner', 1, nbEnhAdvDate.toUTCString());
		});
	});
	</script>
	<div id="nbEnhAdsHeaderBanner" class="avbxouter">
		<div class="avbxmain">
			<span id='close' class="nbEnhAdsHeaderBannerClose">
              
              <img src="CREATE and ADD IMAGE URL of the X  that will close the box here" width="25" height="25" alt=""/>
          </span>
			
        YOUR ADD CODE HERE! 
 
          
		</div>
	</div>
{{endif}}

3) you select  at the css selector simply 

image.png.8b9281f8a6b160e9bd20e003c4a96bac.png

 

The above code is for ALL forum , for the banner to appear after every 50 minutes

 

the code below is for specific forums only :

Edited by MeMaBlue
Posted

This code if for banner to appear in SELECTED forums only. you can see the many numbers -there are the forum ids you need to put. 

:   (109,30,11,10,65,27,165,60,61,118,181,30,11,46,138,159,19,15)   

This code is set to appear every 5 minutes 

 

{{$fid = 0;}}
{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'topic' and request.id}}
	{{ try { $topic = \IPS\forums\Topic::loadAndCheckPerms(request.id); $fid = $topic->container()->_id; } catch(\Exception $e){} }}
{{elseif request.app=='forums' and request.module == 'forums' and request.controller == 'forums'}}
	{{$fid = 0;}}
{{endif}}

{{if $fid and in_array($fid, array(109,30,11,10,65,27,165,60,61,118,181,30,11,46,138,159,19,15))}}
	{{if !isset(cookie.nbEnhAdsHeaderBanner)}}
		<script>
		$(function() {
			$( "#nbEnhAdsHeaderBanner" ).on( "click", ".nbEnhAdsHeaderBannerClose", function() {
				ips.utils.anim.go( "fadeOut", $( "#nbEnhAdsHeaderBanner" ) );
				
              
              var nbEnhAdvDate = new Date();
nbEnhAdvDate.setTime(nbEnhAdvDate.getTime() + 5 * 60 * 1000);
ips.utils.cookie.set('nbEnhAdsHeaderBanner', 1, nbEnhAdvDate.toUTCString());
			});
         
		});
		</script>
		<div id="nbEnhAdsHeaderBanner" class="avbxouter">
			<div class="avbxmain">
				<span id='close' class="nbEnhAdsHeaderBannerClose"><img src="YOUR_IMAGE_URL_HERE_FOR_X_BUTTON" width="25" height="25" alt=""/></span>
				 
 YOUR AD CODE HERE



 
              
		</div>
	{{endif}}
{{endif}}

 

  • 3 weeks later...
  • 1 month later...
Posted (edited)

Hi @newbie LAC, thanks for creating this mod. After moving over from vbulletin, it's been a real struggle to replicate the ads I had before.

I've placed the banner ad below so that it appears above every topic in forum 38

1.thumb.png.f7d9d74fd8f969a1329d5607cf58477e.png

 

using this code which I found earlier on the thread.

{{if \IPS\Request::i()->app == 'forums' and \IPS\Request::i()->module == 'forums' and \IPS\Request::i()->controller == 'topic'}}
	{{$forumId = 0; try { $topic = \IPS\forums\Topic::loadAndCheckPerms( \IPS\Request::i()->id ); $forumId = $topic->forum_id; } catch( \Exception $e ) {};}}
{{endif}}

{{if in_array($forumId, array(38))}}
    code
{{endif}}

 

How can I also display it at the top of the page shown below (which displays all the topics in that forum)?

2.thumb.png.84cab67a87ae49f7551e41dd5b8cdcb3.png

 

Thanks, Rob

 

 

 

Edited by Robert Williams
Posted

Hello,

3 hours ago, Robert Williams said:

How can I also display it at the top of the page shown below (which displays all the topics in that forum)?

{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'forums' and request.id == 38}}
    Code
{{endif}}

 

Posted
3 hours ago, newbie LAC said:

Hello,


{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'forums' and request.id == 38}}
    Code
{{endif}}

 

Thanks for that, one last question :thumbsup:, could you show me the code I'd use for the above, if I wanted the ad to display at the top of several forums eg 10, 16, 38, 40. I gather I'd need to use an array but I don't know the syntax. Thanks

Posted
4 minutes ago, Robert Williams said:

Thanks for that, one last question :thumbsup:, could you show me the code I'd use for the above, if I wanted the ad to display at the top of several forums eg 10, 16, 38, 40. I gather I'd need to use an array but I don't know the syntax. Thanks

{{if request.app == 'forums' and request.module == 'forums' and request.controller == 'forums' and in_array(request.id, array(10, 16, 38, 40))}}
    Code
{{endif}}

 

  • 4 weeks later...
Posted

Hello @newbie LAC !

do you perhaps know  and maybe plan to help how to implement scroller ads? 

its those new ads that show underneath the content , and they have the blessing of users because you scroll over the ad, and therefor can stop if you like it, and it doesnt bother anyone with using the website. 

here is a link i found that describes them ! 

http://www.scrollerads.com/   I would very much like to use one of them!   

 

  • 2 weeks later...
Posted

Hi,

your app won't work correctly on 4.2.5.

  1. no icon in menu in ACPimage.png.8e0f5f7ffb46edcd406032dc194379f5.png
  2. stats generates error:
    Error: Cannot instantiate abstract class IPS\Helpers\Chart\Dynamic (0)
    #0 /var/www/forum.vw-passat.pl/httpdocs/system/Dispatcher/Controller.php(85): IPS\nbenhadverts\modules\admin\adverts\_adverts->stats()
    #1 /var/www/forum.vw-passat.pl/httpdocs/applications/nbenhadverts/modules/admin/adverts/adverts.php(27): IPS\Dispatcher\_Controller->execute()
    #2 /var/www/forum.vw-passat.pl/httpdocs/system/Dispatcher/Dispatcher.php(146): IPS\nbenhadverts\modules\admin\adverts\_adverts->execute()
    #3 /var/www/forum.vw-passat.pl/httpdocs/admin/index.php(13): IPS\_Dispatcher->run()
    #4 {main}

     

  • 2 weeks later...
  • 2 weeks later...
Posted

Pre Sales Questions

Hi, I was going to buy the  ad after x posts & ad after x topics  but from what I can see this does all of that and more?

1 - A review mentions clickbombing protection. I use google adsense, does this app provide clickbombing protection for adsense?

2 - So can I add adverts anywhere? like ordered in my sidebars? I tend to have a 300x250 followed by 300x600 adverts and have different sets for forum sidebar, calendar sidebar, football sidebar etc. I currently use IP custom blocks to place these so will this give me the ability to replace those?

3 - I also name my ads for the location I place them so I know which ones are performing in adsense. Can I make sure for example, advert 1 in a forum / topic that is in position after 3rd topic / post is a specific advert, then the advert that is after position 5 in a topic post / forum is another specific advert?

Thanks in advance.

  • Recently Browsing   0 members

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