Hi all,
I’m writing a snippet that builds the main navigation for a website - one of the navigation items is a weblink (the rest are normal resources).
The code I’ve written works for modResource but not modWebLink (which makes sense given they’re different) but I’m wondering what the best way is to get the modWebLink as well as the modResource - do I have to do 2 separate queries or am I missing something in the below that will do this for me?
// Get level 2 parents
$criteria = $modx->newQuery('modResource', array('parent' => 0));
$criteria->where(array('published'=>true)); // Only published docs
$criteria->where(array('deleted'=>false)); // Only docs that haven't been deleted
$criteria->where(array('hidemenu'=>false)); // Only docs that aren't hidden from the main menu
$criteria->select(array('id', 'menutitle', 'pagetitle')); // We want these fields
$criteria->sortby('modResource.menuindex', 'ASC'); // Order by menuindex ASC
$parents = $modx->getCollection('modResource', $criteria); // Execute the query
Many thanks for you help,
Dan