Conditional: If Not in Forum

Hello all,

I've successfully implemented a Xenforo wrapper around my standard website, but need to put conditional statements in the XF header that:
  • will only show up if the page is outside the forum directory
  • will only show up if the page is inside the forum directory
Forum is installed in /forums, any assistance would be appreciated!
Looking at my previous post, it doesn't do a good job of describing my issue.

I have created a Xenforo wrapper around my Wordpress installation -- you can see it here (the forum itself is in a closed beta, so it's not visible):

I'm using the XF <head> on every page on my site, but need to be able to load scripts etc. depending on whether it's within the forum area or in the Wordpress area.

I could solve it using PHP code and parsing the URL, but PHP doesn't work in the templates as far as I can see.

Is there a way to turn the current URL into a variable in XF and then search it for "/forum"? Is there an easier, more elegant way?