Molecular Recognition in Lamellar Solids and Thin Films