I try to query from the mysql to the frontend web.
by using the snippets below...
name --> (codequery)
CMP class --> ModReviews
path --> ./core/components/modreviews/
<?php
$mReview = $modx->getService('modreviews','ModReviews',
$modx->getOption('modreviews.core_path',null,
$modx->getOption('core_path').'components/modreviews/').'model/modreviews',$scriptProperties);
if (!($mReview instanceof ModReviews)) return 'Invalid class ModReviews';
$limit = $modx->getOption('limit',$scriptProperties,false);
$start = $modx->getOption('start',$scriptProperties,0);
$sort = $modx->getOption('sort',$scriptProperties,'name');
$dir = $modx->getOption('dir',$scriptProperties,'ASC');
/* build query */
$c = $modx->newQuery('modReviews');
if (!empty($query)) {
$c->where(array(
'agent:LIKE' => '%'.$query.'%'
));
}
if ($limit) $c->limit($limit,$start);
$c->sortby($sort,$dir);
$reviews = $modx->getCollection('Review',$c);
return $output."asdf";
and using chunks bellow
write it to the web
===========
but it said
Invalid class ModReviews
===========
I code only this snippet.
how to fix it.
Thanks.
[ed. note: nikom2532 last edited this post 13 years, 8 months ago.]