Jump to content
Announcing Achievements! ×

Community

(NB41) Enhanced Advertisements


newbie LAC

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 480
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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, Use vesion 1.0.7

Hello, You can do it via js $("#elSearchField").attr("placeholder", "Eat at Joes Pizza");  

Posted Images

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

 

Link to comment
Share on other sites

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:

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 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:

Link to comment
Share on other sites

  • 2 weeks later...
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

 

Link to comment
Share on other sites

  • 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*
Link to comment
Share on other sites

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?

Link to comment
Share on other sites

  • 2 weeks later...

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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*
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    No registered users viewing this page.


×
×
  • Create New...

Important Information

We use technologies, such as cookies, to customise content and advertising, to provide social media features and to analyse traffic to the site. We also share information about your use of our site with our trusted social media, advertising and analytics partners. See more about cookies and our Privacy Policy