Mesoporous films containing organic or biological functions within an organised array of cavities are produced by combining sol-gel, self-assembly of supramolecular templates and surface chemistry. This paper reviews the essential physics and chemical concepts behind the synthesis of these complex multifunctional materials.