/** * Creates an article_custom from a given id. * * @param int $id Article ID * @param string $form Form name * @param string $type "next" or "prev" */ public function article($id, $form, $type) { $this->type = $type; $out = article_custom(array('form' => $form, 'id' => $id)); return $out; }
function jmd_rate_article($atts) { extract(lAtts(array('author' => '', 'category' => '', 'form' => 'default', 'keywords' => '', 'limit' => '10', 'max_rating' => '', 'min_rating' => '', 'month' => '', 'section' => '', 'sort' => 'DESC'), $atts)); $matching = getRows("SELECT parentid, avg(value) AS rating FROM " . safe_pfx('jmd_rate') . " GROUP BY parentid HAVING rating BETWEEN {$min_rating} and {$max_rating} ORDER BY rating {$sort} LIMIT {$limit}"); // if no articles match the criteria, exit if (!$matching) { return; } $out = ''; foreach ($matching as $article) { $out .= article_custom(array('author' => $author, 'category' => $category, 'form' => $form, 'id' => $article['parentid'], 'keywords' => $keywords, 'limit' => $limit, 'month' => $month, 'section' => $section)); } return $out; }