stripped down to the basics you can try something like that:
say you have a field alias in your custom-table for friendly-URLs and your detailspage has an alias ’details’
in your listing snippet you will have something like that:
<?php
$objects = $modx->getCollection($classname,$c);
foreach ($objects as $object){
$objectArray = $object->toArray();
$objectArray['url'] = $modx->getOption('site_url').'details/'.$objectArray['alias'];
$output .= $modx->getChunk($tpl, $objectArray);
}
create a plugin, which listens for the event ’OnPageNotFound’ with something like that:
<?php
if ($modx->event->name != 'OnPageNotFound') return;
/*
* set resource-ID where you have your details-snippet
* this can also be custom-system-settings or plugin-properties
*/
$pageid['details']='9999';
/* handle redirects */
$search = $_SERVER['REQUEST_URI'];
$base_url = $this->modx->getOption('base_url');
if ($base_url != '/') {
$search = str_replace($base_url,'',$search);
}
$search = trim($search, '/');
/* get resource to redirect to */
$params = explode('/', $search);
$pagealias=$params[1];
// check if requested object exists
$_REQUEST['alias'] = $params[2];
if (isset($pageid[$pagealias]) && $object = $modx->getObject($classname,array('alias'=>$_REQUEST['alias']))){
/* forward to detailspage */
$this->modx->sendForward($pageid[$pagealias]);
}
return false;
this will send you forward to your details-page where you can get your detail-object with
$object = $modx->getObject($classname,array('alias'=>$_REQUEST['alias']));
may be there are small bugs. But this is the idea how you can do it in modx-Revo.