0 Members and 1 Guest are viewing this topic.
Add a LIMIT is 10 to the query
echo ' <div style="float:left;padding-right: 5px;"><i class="fa fa-pencil-square-o" aria-hidden="true"></i></div><strong>Articles</strong></br>' ;echo ' <hr>' ;// Configuration// Specify your categories, comma separated if more than one category.$categories = array(5,2);$limit = 2;// End Configglobal $scripturl, $smcFunc;$request = $smcFunc['db_query']('', ' SELECT shortname, id, subject, parse FROM {db_prefix}tp_articles WHERE category IN ({array_int:cats}) AND approved = {int:approved} ORDER BY parse ASC', array('cats' => $categories, 'approved' => 1, ));echo ' <ul style="list-style-type:disc; margin: 0pt; padding: 0pt 15px;"> ';while ($row = $smcFunc['db_fetch_assoc']($request)){if (!empty($row['shortname'])) { echo '<li><a href="', $scripturl, '?page=', $row['shortname'], '">', $row['subject'], '</a></li>'; }else { echo '<li><a href="', $scripturl, '?page=', $row['id'], '">', $row['subject'], '</a></li>'; }} echo '</ul>';$smcFunc['db_free_result']($request);
ORDER BY parse ASC LIMIT 10',
$request = $smcFunc['db_query']('', ' SELECT shortname, id, subject, parse FROM {db_prefix}tp_articles WHERE category IN ({array_int:cats}) AND approved = {int:approved} ORDER BY parse ASC', LIMIT 10', array('cats' => $categories, 'approved' => 1, )