We study a periodic medium driven over a random or periodic substrate. Our work is based on nonequilibrium continuum hydrodynamic equations of motion, which we derive microscopically. We argue that in the random case instabilities will always destroy the LRO of the lattice. In most, if not all, cases, the stable driven ordered state is a transverse smectic, with ordering wavevector perpendicular to the velocity. It consists of a periodic array of flowing liquid channels, with transverse displacements and density (``permeation mode'') as hydrodynamic variables. We present dynamic functional renormalization group calculations in two and three dimensions for an approximate model of the smectic. The finite temperature behavior is much less glassy than in equilibrium, owing to a disorder-driven effective ``heating'' (allowed by the absence of the fluctuation-dissipation theorem). This, in conjunction with the permeation mode, leads to a fundamentally analytic transverse response for $T>0$. Our results are compared to recent experiments and other theoretical work.