Absolutely! Here's a simple one. Make a Template that is a "sorted list". Make a template variable that acts as a string for a field that you want to sort by. Make two documents, and set the tv to different field names. In each of the pages make the same Snippet call ('mySnippet'). I should mention that the code below follows a bad example and should templatize the output.
mySnippet:
$fieldname = $modx->resource->getTVValue('sortbyfield');
$query = $modx->newQuery('modResource',
array('parent'=>0)
);
$query->sortby($fieldname, 'ASC');
$list = $modx->getCollection('modResource', $query);
foreach ($list as $key => $res)
{ $output='<ul>';
if(!empty($res))
$output .= '<li>'. $res->get('alais') .'</li>';
$output .= '</ul>';
}
Further, you could make a Resource that queries database objects and provides a list of them to the front-end. Instead of making a Snippet that does them all, you could make a single Resource. It accepts a URL parameter (not GET param) for the type of database object to list. Now you have one page that can sniff your entire MODX list. (This is not a good example, just an example).
Just in case these doesn't illustrate my point (you might wanna check out RO.IDEs proposed Add-on thread), since the tables are already abstracted via xPDO, we can further abstract them to provide more uses. For instance, you could make a Snippet out of a Resource and add code in TVs that could mutate the Snippet based on "web application state".
With xPDO, you can do what you want, when you want, how you want. You just gotta have imagination. Right now, all of this is being applied to a developer's social blogging network called Extended Dialog. The site is not quite ready, but is demonstrable. Here is the link:
http://users.extendeddialog.com/user/2
There are 12 blogs on the site, so far, all created dynamically. There is one "mini profile" snippet for each type of blog (3 types). The tags are actually resources (which have no content yet), similar to StackOverflow or other Wiki tags. AJAX queries, Snippets and Plugins are all being run by RO.IDEs on top of the MODX Framework.
To make the queries happen, I use URL params, site-wide aliases across contexts (to keep in same domain), and Chunks filled with straight CSS and JS. The profile page I linked you to accesses (now) over 650 resources on the site at once. Again, nearly the entire site is managed with xPDO queries.
I hope this gives a clearer picture of what I mean. Class Constants are the basest form of abstraction; they are useful but hold nothing compared to the power of xPDO and MODX. In other words, you could build an entire CMS on top of the MODX CMS (if you wanted to... I'll just stick with MODX).
[ed. note: fuzzicallogic last edited this post 11 years, 8 months ago.]