XF 2.2 ad manager conditionals

briansol

Well-known member
I run an ad through the xf ad manager.

it is located via, /admin.php?advertising/ad-title.7/edit
so, i assume ad ID 7.

Is there a template conditional i can use in PAGE_CONTAINER to look for this ad being included later in the page? Reason is, this particular ad has a 'head' piece and a 'body' piece. I would like to only include the head part if ad ID 7 is active on this view. I put the body part in the admanager.

is there something like is="$ad.ad_id = 7" ? and in scope in the wrapper template?
 
Last edited:

Brogan

XenForo moderator
Staff member
There is no such var.

It's not really clear what you're trying to do though.

Is the ad displayed on every page?
If so, add the head code to the PAGE_CONTAINER template as is.

If not, wrap the head code in a template conditional.
 

briansol

Well-known member
I turn it off and on a lot with the 'is ad active?' option, and a/b test it with other ads frequently. It's not on every page and may not be on at all, so i don't want the JS included in the head if it's not needed.

maybe this psuedo code explains it better
<head>
if(ad7 enabled and page contains ad 7) { <script.... }
</head>
<body>
adhook_position_x {
<div id=ad_7>
ad_7.render
}
</div>
 

Brogan

XenForo moderator
Staff member
It's not possible.

You can't even set a var in the ad template and pass it to the page container and check for the existence of that - it doesn't work as ad templates are not true pages.

1614879368764.png
 
Top