The capillary flow alignment of the thermotropic liquid crystal 4-n-octyl-4'-cyanobiphenyl in the nematic and smectic phases is investigated using time-resolved synchrotron small-angle x-ray scattering. Samples were cooled from the isotropic phase to erase prior orientation. Upon cooling through the nematic phase under Poiseuille flow in a circular capillary, a transition from the alignment of mesogens along the flow direction to the alignment of layers along the flow direction (mesogens perpendicular to flow) appears to occur continuously at the cooling rate applied. The transition is centered on a temperature at which the Leslie viscosity coefficient alpha3 changes sign. The configuration with layers aligned along the flow direction is also observed in the smectic phase. The transition in the nematic phase on cooling has previously been ascribed to an aligning-nonaligning or tumbling transition. At high flow rates there is evidence for tumbling around an average alignment of layers along the flow direction. At lower flow rates this orientation is more clearly defined. The layer alignment is ascribed to surface-induced ordering propagating into the bulk of the capillary, an observation supported by the parallel alignment of layers observed for a static sample at low temperatures in the nematic phase.