Exploiting transport phenomena to synthesize functional materials within template nanomembranes