function articlesFrontpage() { global $layout; global $languageChoice; global $layoutstatus; $remaining_characters = 0; $NO_COLUMNS = $layout; debug("Antall kolonner: " . $layout . " og status" . $layoutstatus); printDebug(); if ($layout == 1) { $NO_ARTICLES = 10; } else { if ($layout == 2) { $NO_ARTICLES = 21; } else { if ($layout == 3) { $NO_ARTICLES = 34; } else { if ($layout == 4) { $NO_ARTICLES = 41; } else { $NO_ARTICLES = 10; } } } } $counter = 0; $articles = getFrontpageArticles($NO_ARTICLES, $languageChoice); if (count($articles) == 0) { table_open(); tr_open(); td_open(1); global $no_articles_text; print $no_articles_text; td_close(); tr_close(); table_close(); return; } table_open(); tr_open(); td_open($NO_COLUMNS); $remaining_characters = printTopArticle($articles[0]); div_open("showarticlelink"); print_article_link($articles[0]['articleid'], "Vis", $remaining_characters); print_comments_link($articles[0]['articleid'], " Kommentarer"); div_close(); td_close(); tr_close(); // Get rid of the first array element array_shift($articles); if ($NO_COLUMNS == 1) { foreach ($articles as $article) { tr_open(); td_open(1); $remaining_characters = printTopArticle($article); div_open("showarticlelink"); print_article_link($article['articleid'], "Vis", $remaining_characters); print_comments_link($article['articleid'], " Kommentarer"); div_close(); td_close(); tr_close(); } } else { tr_open(); foreach ($articles as $article) { td_open(1); $remaining_characters = printThumbArticle($article); div_open("showarticlelink"); print_article_link($article['articleid'], "Vis", $remaining_characters); print_comments_link($article['articleid'], " Kommentarer"); div_close(); td_close(); if ($counter + 1 == $NO_COLUMNS) { tr_close(); tr_open(); $counter = 0; } else { $counter++; } } tr_close(); } table_close(); }
function textSearchResultGUI() { if (isset($_REQUEST['nopartialmatch'])) { $partialmatch = 0; } else { $partialmatch = 1; } if (isset($_REQUEST['searchcomments'])) { $searchcomments = 1; } else { $searchcomments = 0; } $table = textSearchService($_REQUEST['text'], $partialmatch, $_REQUEST['author'], $searchcomments); if ($searchcomments) { h3("Søkte etter '" . $_REQUEST['text'] . "' i alle artikler og kommentarer, " . count($table) . " treff, nyeste først"); } else { h3("Søkte etter '" . $_REQUEST['text'] . "' i alle artikler, " . count($table) . " treff, nyeste først"); } if ($table == NULL) { //echo("no_articles_with_that_text"); echo "Sorry Mac!"; } else { table_open(); foreach ($table as $row) { tr_open(); echo '<td style="width:80px">'; echo make_ddmmyy_date($row['date_posted']); td_close(); td_open(1); if (isset($row['comment_to'])) { print_article_link($row['comment_to'], $row['title']); echo "(Kommentar til: "; print_parent_article_link($row['comment_to']); echo ")"; } else { print_article_link($row['articleid'], $row['title']); } td_close(); td_open(1); echo $row['author']; td_close(); tr_close(); tr_open(); td_open(3); echo create_paragraph($row['body'], 200, 200); echo "..."; br(); br(); td_close(); } table_close(); } }