Ads after category on index


I want to place an ad or code after a category on the index page.

For example say I have two categories called A and Z I want it to be like this:

A Category
- A Forum
Z Category
- Z Forum

So I pretty much want an ad in between the categories.

There is this: but it's only for phpBB. I have used that code in the past on a phpBB board and it's done exactly what I have wanted.

Is there a way to change a phpBB IF statement to a Xenforo one maybe?