Ok, to avoid both problems I propose slightly different solution. Can you read hints_via_ajax.tmpl content in a code and then pass it to templatefile. This will eliminate #include whatsoever. Just make approrpriate comment in templatefile saying that we read ajax code and pass it into template.