This is somewhere between trivial and the biggest pain in your rear end that you've ever experienced...
Basically, create a subroutine that returns a fully qualified path (i.e. "$vars_confing{NonCGIPath}/Templates/new"), then retrofit each call to a template to do that first, then use its path...
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.