Unlucky Posted January 27, 2019 Posted January 27, 2019 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
Sonya* Posted January 27, 2019 Posted January 27, 2019 (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 January 27, 2019 by Sonya* Unlucky 1
newbie LAC Posted January 28, 2019 Author Posted January 28, 2019 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 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 Sonya* 1
Sonya* Posted January 28, 2019 Posted January 28, 2019 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.
newbie LAC Posted January 29, 2019 Author Posted January 29, 2019 Hello, 5 minutes ago, Amon-Ra said: Can you include php code? php in the adverts? You can use 111111111 1
Percival Posted February 5, 2019 Posted February 5, 2019 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?
newbie LAC Posted February 6, 2019 Author Posted February 6, 2019 (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 February 6, 2019 by newbie LAC Percival 1
Paweł Mysłek Posted February 21, 2019 Posted February 21, 2019 @newbie LAC Please update under IPS 4.4
111111111 Posted February 22, 2019 Posted February 22, 2019 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:
newbie LAC Posted February 22, 2019 Author Posted February 22, 2019 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?
111111111 Posted February 27, 2019 Posted February 27, 2019 On 2/22/2019 at 2:35 AM, newbie LAC said: Hello, Any errors on 4.4? 4.3 or 4.4? 4.3
newbie LAC Posted February 27, 2019 Author Posted February 27, 2019 Hello, I think this not related to app. You can find posts with similar errors.
Unlucky Posted March 8, 2019 Posted March 8, 2019 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
newbie LAC Posted March 9, 2019 Author Posted March 9, 2019 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 Unlucky 1
Unlucky Posted March 9, 2019 Posted March 9, 2019 6 hours ago, newbie LAC said: Uncaught ReferenceError: googletag is not defined Thank you - all fixed
Sonya* Posted May 2, 2019 Posted May 2, 2019 (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 May 2, 2019 by Sonya*
newbie LAC Posted May 2, 2019 Author Posted May 2, 2019 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?
Sonya* Posted May 2, 2019 Posted May 2, 2019 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 Forget it, the condition is buggy
newbie LAC Posted May 2, 2019 Author Posted May 2, 2019 (edited) 15 minutes ago, Sonya* said: Forget it, the condition is buggy I added some piece of code to prevent errors + added logging (if you have enabled Debug logging) Edited May 2, 2019 by newbie LAC Sonya* 1
Sonya* Posted May 16, 2019 Posted May 16, 2019 Do you have an example for the condition to exclude ads on the views of featured and pinned records?
newbie LAC Posted May 16, 2019 Author Posted May 16, 2019 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}} Sonya* 1
Sonya* Posted May 16, 2019 Posted May 16, 2019 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! 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.
Sonya* Posted May 16, 2019 Posted May 16, 2019 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...
Sonya* Posted May 16, 2019 Posted May 16, 2019 (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 May 16, 2019 by Sonya*
Recommended Posts