A new type of metal-phosphate-base cation sensor is constructed via attaching organic TPT fluorophores to the framework of the porous inorganic layers. It shows excellent sensitivity and selectivity for a series of cations.