The general idea behind using custom tables for your non-page content (events, polls, blog data) is that resources aren’t optimized for that kind of data. Sure - you can do it, and make use of general addons available as well as heavy use of TVs, and that’s all great. But when you start hitting the thousands and beyond, you will start noticing there’s some overhead in there that you could save by using a data structure optimized for the specific goal.
And if you decide half-way through you want to view your items in a different way, you can do that without having to import all your items into a new system.
The MODX API is quite straightforward: here’s a snippet (untested) that would search your blog content for a certain searchterm..
$searchterm = 'blog';
$query = $modx->newQuery('modBlog');
$query->where(array(
'blogentry:LIKE' => "%$searchterm%"));
$numofresults = $modx->getCount('modBlog',$query);
$query->limit($maxresults,$offset);
$results = $modx->getCollection('modBlog',$query);
$output = '';
foreach ($results as $r) {
$output .= 'Result found: '.$r->get('blogtitle').PHP_EOL;
}
return $output;
That’s it, and it could be made as flexible as you want in a short amount of time with a bit of php knowledge.
You can definitely use resources, and some addons like AutoFolders make it a heck of a lot easier to manage it (you should have a look at that Patrick for that site!), but nothing can beat a custom tailored solution when done right.