look at TYPO3's EEL/FlowQuery
look at TYPO3's EEL/FlowQuery