Hi chinty74, Just to summarise for other readers: you want to show a different advert above the post title, based on the post category. This isn't supported by the Ad Injection UI, but Ad Injection allows PHP in its ad boxes. I have provided an example of loading ads based on categories, but you now want to extend it to randomly choose from a pool of ads for each category.
Yes you would need to modify your template to do this - you can use an Ad Injection template ad tag above your post title to do this. Ad Injection will generate an example template ad tag for you (with the correct path) - look in the 'test ads and template ad examples' at the bottom of the main UI.
The problem with one text file for each rotated ad in each category is that your PHP code has to know how many ads there are. Here's some options:
1. You could hard code the number of ads for each category into the PHP, but then the code would need updating if you changed the number of ads.
2. The PHP code could count the number of ads with the name [category][number].txt assuming that all numbers are sequential and start from 1 - this would be more flexible.
If you did store the ads in individual text files I's suggest you put a number after *each* ad so travel1.txt, travel2.txt etc. If you called the first one travel.txt with no number then the names would be inconsistent.
In your PHP code you could then generate a random number between 1 and the number of ads you have, and append this to the name of the ad file which the PHP is loading.
If you know a bit of PHP this shouldn't be too hard. If you come up with a solution do share it!
I might have a go at this myself in the next week. If I come up with a solution I'll post it here and in the FAQ.