Jump to content

(NB41) Enhanced Advertisements


Recommended Posts

Posted

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

Posted (edited)
11 minutes ago, Unlucky said:

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

Hello,

15 hours ago, Sonya* said:

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

15 hours ago, Sonya* said:

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

14 hours ago, Unlucky said:

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

 

Posted
48 minutes ago, newbie LAC said:

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. 

50 minutes ago, newbie LAC said:

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

This would be perfect. :rolleyes:

Posted

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?

Posted (edited)
9 hours ago, Anawa said:

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

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:

Posted

Hello,

10 hours ago, Paweł Mysłek said:

@newbie LAC  Please update under IPS 4.4

Any errors on 4.4?

34 minutes ago, Amon-Ra said:

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

4.3 or 4.4?

  • 2 weeks later...
Posted

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

 

Posted
11 hours ago, Unlucky said:

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

 

  • 1 month later...
Posted (edited)

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*
Posted
1 minute ago, Sonya* said:

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?

Posted
Just now, newbie LAC said:

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:

  • 2 weeks later...
Posted

Hello,

16 minutes ago, Sonya* said:

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

 

Posted
22 minutes ago, newbie LAC said:

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.

Posted

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

Posted (edited)

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 members

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