Get value from URL query string & display in RSS feed

Silverstripe Version: 3.6.5


Hi, I’m trying to display a value from a URL query string in the output of a blog RSS feed.

I’ve tested the below code on a HomePage.php controller:

	public function init()
    public function InterestArea()
        return $this->getRequest()->getVar('BlogCategory');

and the template file:


But no matter what I do, I can’t get this displaying on an RSS feed from the blog (using the blog module). Any ideas on where I’m going wrong? Cheers

Have you tried just returning a fixed string from the function? (Just to check it’s actually working)
Try changing the function to public function getInterestArea() (I can’t remember whether it makes a difference on 3.6)

Thanks heaps for your help mate. Making a fixed string first and going from there was the answer I needed thanks.

I needed to add the following code snippet into ‘framework > api > RSSFeed.php’

public function InterestArea() {
    return $_GET['BlogCategory'];

After that, simply adding ‘/rss?BlogCategory=TestValue’ was all that was needed. Cheers!