Jump to content

(NB41) Enhanced Advertisements

Featured Replies

OK so I am trying to get an advert for mobile devices only

I want it to sit above the IPS mobile nav bar.

I think the area is <ul id="elMobileNav" class="ipsList_inline ipsResponsive_hideDesktop ipsResponsive_block" data-controller="core.front.core.mobileNav"><li>
 

I have tried adding the following to the advert custom css and position but it does not show:

.ipsList_inline ipsResponsive_hideDesktop ipsResponsive_block

I chose the option to insert advert before the chosen elements

Where am I going wrong?

Thanks

  • Replies 509
  • Views 56.6k
  • Created
  • Last Reply

Top Posters In This Topic

Most Popular Posts

  • Right...I think we all understand this. He's not been heard from since Jan 2021. Unfortunately I'm unable to wait until he's back here to update this application, as I need it updated for 4.6 and

  • newbie LAC
    newbie LAC

    Hello again You can add in your code data-excludequote Example <div style="float:right; position:relative; padding: 0 0 0 5px;" data-excludequote> Google ads code </div&gt

  • Hello, 1. https://invisionpower.com/forums/topic/429838-nb41-enhanced-advertisements/?do=findComment&comment=2638531 2. HTML  {{if (\IPS\Request::i()->app == 'forums' and \IPS\R

Posted Images

 

Where am I going wrong?

You have to chain class selectors if they are applied to one element:

.ipsList_inline.ipsResponsive_hideDesktop.ipsResponsive_block

 

Edited by Sonya*

  • Author

Hello,

 

However this is how default advertisement places work. If I add 3 adverts to the header then they are never displayed one below the other. They rotate on the same place changing randomly on every page load. But they never displayed together. There is only one advert on every page load.

Please read the setting description

  Quote

You can use this setting to control how advertisements are selected for display when more than one advertisement is configured to show in a single location

Location

locations.thumb.jpg.9e75b78e11f609e3d7bb9eb5dcc3e8ed.jpg

 

Edit: I have just realized that there is no unique ID for CSS selector so that rotation is not possible. Have you probably any solution for it?

I can add new setting Show unique (selector + position) adverts and use inbuilt setting Advertisement circulation

 

I think the area is <ul id="elMobileNav" class="ipsList_inline ipsResponsive_hideDesktop ipsResponsive_block" data-controller="core.front.core.mobileNav"><li>

It would be better use as selector

#elMobileNav

 

 

Please read the setting description

I have just assumed that "CSS selector" is something like "Define your own location". That's why I thought the adverts should rotate in "CSS selector location" as in any other location. 

 

I can add new setting Show unique (selector + position) adverts and use inbuilt setting Advertisement circulation

This would be perfect. :rolleyes:

Can you include php code?

  • Author

Hello,

 

Can you include php code?

php in the adverts?

You can use 

 

I tried to add extra condition to show/not show ad when URL contains specific phrase. I tried adding:

{{ if(strpos($_SERVER['REQUEST_URI'], 'test') !== false); }}

But that did not work at all. Did I miss something?

  • Author
 

I tried to add extra condition to show/not show ad when URL contains specific phrase. I tried adding:

{{ if(strpos($_SERVER['REQUEST_URI'], 'test') !== false); }}

But that did not work at all. Did I miss something?

Hello,

Show ad

{{if (\mb_strpos($_SERVER['REQUEST_URI'], 'test') !== false)}}
1
{{endif}}

Hide ad

{{if !(\mb_strpos($_SERVER['REQUEST_URI'], 'test') !== false)}}
1
{{endif}}

 

Edited by newbie LAC

  • 3 weeks later...

approximately every 48 the cache is destroyed since you started using your plugin

2019/02/19 09:27:02 [error] 7536#7536: *3109334 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'IPS\Theme\Cache\class_forums_front_forums' not found in /var/www/clients/client0/web1/web/system/Theme/Theme.php(871) : eval()'d code on line 11" while reading response header from upstream, client: 179.60.18.7, server: xxxx.com, request:

  • Author

Hello,

 

@newbie LAC  Please update under IPS 4.4

Any errors on 4.4?

 

approximately every 48 the cache is destroyed since you started using your plugin

4.3 or 4.4?

 

Hello,

Any errors on 4.4?

4.3 or 4.4?

4.3

  • Author

Hello,

I think this not related to app.

You can find posts with similar errors.

  • 2 weeks later...

Hi,

Since upgrading everything to the latest versions I have lost our advert at the very top of the websites above the site logo

This is the code we in the custom css and positioning had that worked before - any ideas?

.ta_headerContainer

 

  • Author
 

Hi,

Since upgrading everything to the latest versions I have lost our advert at the very top of the websites above the site logo

This is the code we in the custom css and positioning had that worked before - any ideas?

.ta_headerContainer

 

Hello,

I see in console

Uncaught ReferenceError: googletag is not defined

 

 

Uncaught ReferenceError: googletag is not defined

Thank you - all fixed

  • 1 month later...

When I create a new condition and apply it to the advertisement, then the site throws error 500. In server logs I see the fatal error:

Method IPS\core\Advertisement::__toString() must not throw an exception, caught ParseError: syntax error, unexpected ':'

File: /htdocs/init.php(867) : eval()'d code

When condition is "unapplied" then error disappears. 

The condition is

{{if in_array(request.app, array('forums', 'gallery')}}1{{endif}}

 

Edited by Sonya*

  • Author
 

When I create a new condition and apply it to the advertisement, then the site throws error 500. In server logs I see the fatal error:

Method IPS\core\Advertisement::__toString() must not throw an exception, caught ParseError: syntax error, unexpected ':'

File: /htdocs/init.php(867) : eval()'d code

When condition is "unapplied" then error disappears. 

Hello,

I'll look into that.

Could you post your condition content/code?

 

Could you post your condition content/code?

Sure. I have edited my post above. You are just too fast with your answers :biggrin:

Forget it, the condition is buggy :biggrin:

  • Author
 

Forget it, the condition is buggy :biggrin:

I added some piece of code to prevent errors + added logging (if you have enabled Debug logging)

error.thumb.jpg.324e322b1ce36732592a193b2297015b.jpg

Edited by newbie LAC

  • 2 weeks later...

Do you have an example for the condition to exclude ads on the views of featured and pinned records? 

  • Author

Hello,

 

Do you have an example for the condition to exclude ads on the views of featured and pinned records? 

{{if !(isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_class']) and is_subclass_of(\IPS\Output::i()->hiddenElements['nbenhadverts_item_class'], 'IPS\cms\Records') and isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_item']) and $item = \IPS\Output::i()->hiddenElements['nbenhadverts_item_item'] and ($item->mapped('pinned') or $item->mapped('featured')))}}1{{endif}}

 

 

Hello,

{{if !(isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_class']) and is_subclass_of(\IPS\Output::i()->hiddenElements['nbenhadverts_item_class'], 'IPS\cms\Records') and isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_item']) and $item = \IPS\Output::i()->hiddenElements['nbenhadverts_item_item'] and ($item->mapped('pinned') or $item->mapped('featured')))}}1{{endif}}

 

I have written records but I have not meant CMS records explicitly. Sorry! :blush: 

This condition did not work for me, even if I tried to change the class in the condition to other class. I now use the condition:

{{if $item = \IPS\Output::i()->hiddenElements['nbenhadverts_item_item'] and !($item->mapped('pinned') or $item->mapped('featured'))}}
	Show advert only if not pinned or featured
{{endif}}

This seems to work as desired in all applications.

Hmm, my code does not work either...

What I try to achieve is to place a banner into default location Just below the page header but not on the views of the items that are pinned or featured. Means the banner should be shown across the whole community, every page, but not on the detailed views of the pinned or featured items. The application is not important, it should apply to forum, cms, blogs, clubs and so on...

This seems to make the job:

{{if !(isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_class'])) or (isset(\IPS\Output::i()->hiddenElements['nbenhadverts_item_item']) and $item = \IPS\Output::i()->hiddenElements['nbenhadverts_item_item'] and !($item->mapped('pinned') or $item->mapped('featured')))}}
	Show advert everywhere except of pinned and featured items
{{endif}}

Edit: it does not work for featured clubs. I assume because the club is not really an item but something else. Node?

Edited by Sonya*

Recently Browsing 0

  • No registered users viewing this page.