Hexagonal mesoporous silica layers were first prepared by the sol-gel route from solutions containing silicon alkoxides as silica precursors and alkyltrimethylammonium bromides to form the templating liquid crystal mesophase. The synthesis conditions required to obtain well-ordered crack-free layers were investigated. Two main synthesis parameters were identified. The first one is the aging time of the sol before deposition which defines the size of the inorganic cluster before the thin layer deposition and the simultaneous phase formation. The second important synthesis parameter is the surfactant volume fraction in the medium after the departure of the volatile components. Well-ordered hexagonal layers were obtained for surfactant volume fractions in agreement with the water-surfactant binary diagram. These synthesis conditions were extended to cubic and lamellar phases and to other types of surfactants, gemini (cationic surfactants with two polar head groups) and non-ionic triblock copolymers. First results concerning the extension of this approach to the preparation of alumina thin layers are finally presented.