Jump to content

(NB41) Enhanced Advertisements


Recommended Posts

Just purchased this. Works perfectly with selector+position examples but I have no idea how to publish ads after 1st post in specified categories.. Could you please give me selector and position?

And how I solve category ID? www.foo.bar/forum/2-common/ Thought it's "2" but it's not..

 

Edited by sulervo
Link to comment

Like this way?

{{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(3, 4))}}
code
{{endif}}

4 hours ago, sulervo said:

And how I solve category ID? www.foo.bar/forum/2-common/ Thought it's "2" but it's not..

Actually this number is category ID?

Link to comment
13 hours ago, sulervo said:

If I would like to upload banners to the system then category based targeting is not possible? I mean that other option if you don't want to use HTML code.

Use the setting "Extra condition"

{{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(3, 4))}}
1
{{endif}}

 

Link to comment
  • 3 weeks later...
  • 2 weeks later...
On 24.3.2017 at 7:06 AM, newbie LAC said:

Use the setting "Extra condition"


{{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(3, 4))}}
1
{{endif}}

 

If system select ad which condition is false it shows nothing? Is there possible to determine backup ad which shows if condition doesn't match?

Link to comment

Hello,

20 minutes ago, sulervo said:

If system select ad which condition is false it shows nothing?

Yes

20 minutes ago, sulervo said:

Is there possible to determine backup ad which shows if condition doesn't match?

Currently no.

Edited by newbie LAC
Link to comment
5 minutes ago, newbie LAC said:

Hello,

Selector 


#elNavSecondary_1 .ipsNavBar_secondary

Position


Insert advert inside the chosen element(s), at the end

 

Thanks, however seems that due to design it looks a bit strange :-) also due to the different tabs, its a bit moving arround now :-)

If you re-look at my example, maybe its better to put it on the left side of the Seach bar, right alinged? (at main navbar)

Thanks again for your great support :-)

Link to comment
1 minute ago, Karel Beuckelaere said:

Thanks, however seems that due to design it looks a bit strange :-) also due to the different tabs, its a bit moving arround now :-)

I gave you selector and position. Other things are css.

See my example

<span class="ipsPos_right" style="margin: 10px;">Right Side of the Second NavBar</span>

Result

rs.thumb.jpg.99536afd4b5908860d367d53b7827a65.jpg

Link to comment
  • 2 weeks later...

Is there a way to use the css selector and have ads rotate in a position?  

Right now, both ads are showing up.  Would love to sell multiple ads in specific spots using the css selector, but not really sure how to do it.

Link to comment
12 hours ago, Bluto said:

Is there a way to use the css selector and have ads rotate in a position?  

Right now, both ads are showing up.  Would love to sell multiple ads in specific spots using the css selector, but not really sure how to do it.

Hello,

I don't know how you will set up your ads for this. Therefore I propose my solution

HTML

{{$r = mt_rand(1,3);}}
{{if $r == 1}}
	<div class="ipsMessage ipsMessage_error">
		This is an error message.
	</div>
{{elseif $r == 2}}
	<div class="ipsMessage ipsMessage_success">
		This message indicates something happened successfully.
	</div>
{{else}}
	<div class="ipsMessage ipsMessage_warning">
		This message warns the user of something terrible (or not so terrible).
	</div>
{{endif}}

Selector 

#elContent

Position

Insert advert before the chosen element(s)

Result (I refresh the page)

mess.thumb.gif.246186e5dfa0e3261f3b14c01e16c5af.gif

Edited by newbie LAC
Link to comment

Thanks for the previous code!

I'm also trying to figure out how to create an if statement = if an advertisement key is disabled it will show something else.  In my case I'm using links in my footer in a list and I don't want the lines of links to be blank if no one is advertising.

{advertisement="footer_text_advert_1"}

Trying a bunch of thing to get this setup.  Below is the last code I tested.  What would be the if part of the statement?  I've tried = NULL, = 0, empty, isset, !=, figured you might know since you deal with all the variables.  I don't code IPB enough to know what I'm supposed to use.

{{if advertisement.footer_text_advert_1 > 0}}
	{advertisement="footer_text_advert_1"}
{{else}}
	Some other link.
{{endif}}

I appreciate any help you can give me.  :)

 

Got it, I believe.

{{if empty( \IPS\core\Advertisement::loadByLocation( 'ad_key' ))}}

Nothing Here

{{else}}

{advertisement="ad_key"}

{{endif}}

 

Edited by Bluto
Link to comment

Thanks for the code.  The code I put in above,  I copied from one of the IPS premade spots.

This is going to work great for text links in the footer (or anywhere else on the site) which can be sold in the store.  If some links aren't purchased, I have a default ads created called filler ads to fill in the non-sold spots.

Edited by Bluto
Link to comment
  • Recently Browsing   0 members

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