The general approach to mesoporous ordered silica and crystalline metal oxide thin films, involving soft chemistry, liquid deposition technique, surfactant templating and tuned annealing conditions, is presented. Highly ordered cubic mesoporous structures, made of amorphous SiO2 xerogels or nanocrystalline particles such as anatase TiO2, gamma-Al2O3, ilmenite CoTiO3, or perovskite SrTiO3 have been chosen to illustrate this article. In situ time resolved SAXS analyses, involving synchrotron high flux, were used to assess the various phenomena involved during deposition, thermal treatment and crystallisation. It will be demonstrated that the self-assembly is not only critically dependant on the structuring agent to inorganic volume fraction, but also on chemical and processing parameters such as the inorganic degree of condensation and the atmosphere applied during the deposition. A general model of self-assembly, based on a Tunable Stated State, is proposed. Concerning the crystallisation step, we will show that, depending on the heating regime, ordered mesoporous nanocrystalline framework can be obtained through a rigorous control of nucleation, growth and diffusive sintering taking successively place in the mineral matrix. Finally, the porosity and pore size distribution of these silica and non silica layers were assessed using ellipsometry porosimetry. This novel and very efficient technique provides the full characteristics of the layer porosity by measuring the variation of optical constant associated to the adsorption/desorption of a gas within the porous network.