XF 2.2 accessing vars in a dump

eDaddi

Active member
I'm trying to use the 'Display condition' in a widget to only show the widget when a certain ad is displayed.

I do this:
Code:
{{ dump($xf.samAds)}}

and get this:
Screen Shot 2021-06-03 at 9.44.29 PM.png

I can't figure out how to determine if the 'sponsoredText' or 'sponsoredLogo' values are there or not. What are the # lines? '#ads' in this example. I tried treating them as objects and arrays but can't access them.
 
The # means protected:
HTML:
#<span class=sf-dump-protected title="Protected property">ads</span>:

In php it's easy to check if a property exists, how can I do it with XF's syntax so I can use it as a display condition? Clearly it's available to check
 
I would expect the vars to be something like $xf.samAds.sponsoredText and $xf.samAds.sponsoredLogo but as it's third party code, it's something you will need to ask the add-on author about.
 
I would expect the vars to be something like $xf.samAds.sponsoredText and $xf.samAds.sponsoredLogo but as it's third party code, it's something you will need to ask the add-on author about.
That was my first guess too, I wouldn't think that it being 3rd party has anything to do with it as it's being output exactly as the rest of XF's variables. I seen this thread where @Earl used underscores to access these, but I can't get that to work either.

@Siropu , how can I detect if an ad is on a page or not? I have a widget I only want in certain forums, they display ads from your add-on. It's really easy in your add-on to select what forums the ads go in, now I just need the widget to detect if they are on/off for a page in order to display the widget or not. Otherwise I have to make a big in_array with all the forum ids I want or dont want to display it in.
 
To clarify, you need to post the question in the resource thread, as that is where support for third party resources is limited to.
 
Top Bottom