Further adapt TopicNode view for multiple projects

With much more work being done in the database, had to tweak things to
reduce queries. There's more to be done but not at the moment.

Also, I've started to separate out template elements into includes
(finally)