news_page -- useful perhaps for caching news pages with a cache class -- Outputs valid XHTML Copyright © 2003-2005 Joshua Dechant. All Rights Reserved. Released under the GNU General Public License */ class newsDisplay { var $news_page; function newsDisplay() { $this->reset(); } function reset() { $this->news_page = ''; } function newsHeader($header, $date, $links_array = false) { $this->news_page .= '' . "\n"; $this->news_page .= '
' . $date; if ($links_array && is_array($links_array)) { foreach ($links_array as $link) { $this->news_page .= ' | ' . $link['text'] . ''; } } $this->news_page .= '
' . "\n"; $this->clearSplit(); return true; } function articlesNotFound($not_found_text) { $this->news_page .= '

' . $not_found_text . '

' . "\n"; return true; } function articleHeading($heading) { $this->news_page .= '

' . $heading . '

' . "\n"; return true; } function articleByLine($by_author_text, $comments_url = false, $comments_url_text = false) { $this->news_page .= '

' . $by_author_text . ''; if ($comments_url && $comments_url_text) { $this->news_page .= ' | ' . $comments_url_text . ''; } $this->news_page .= '

' . "\n"; return true; } function articleText($text, $image = '', $html_text = true, $clearbreak = true) { if ($image != '') { $this->news_page .= $image; } if ($html_text) { $this->news_page .= $text . "\n"; } else { $this->news_page .= nl2br($text) . "\n"; } if ($clearbreak) { $this->news_page .= '

' . "\n"; } return true; } function articleSummary($article_name, $article_summary_text, $article_url, $article_url_text, $image = false) { $this->news_page .= '
' . "\n"; if ($image && $image != '') { $this->news_page .= $image; } $this->news_page .= '

' . $article_name . '
' . $article_summary_text . '

' . "\n"; $this->news_page .= ' ' . "\n"; $this->news_page .= '
' . "\n"; return true; } function articleLinksBlock($links_block) { foreach ($links_block as $links) { $this->news_page .= '' . "\n"; } return true; } function articleListing($article_array) { $this->news_page .= '' . "\n"; return true; } function articleFooter($heading, $footer_array, $footer_date_url = false, $footer_date_text = false, $split_after = true) { if (is_array($footer_array)) { $this->clearSplit(); $this->articleHeading($heading); $this->news_page .= '' . "\n"; if ($footer_date_url && $footer_date_text) { $this->clearSplit(); $this->news_page .= '

' . $footer_date_text . '

' . "\n"; } $this->clearSplit(); if ($split_after) { $this->splitSolid(); } } return true; } function articleBackLink($link, $link_text) { $this->news_page .= '' . "\n"; return true; } function commentsNotFound($not_found_text) { $this->news_page .= '

' . $not_found_text . '

' . "\n"; return true; } function articleComments($commentor, $comments, $date_added, $subject = false, $html_text = true) { $this->news_page .= '
' . "\n"; $this->news_page .= '

'; if ($subject) { $this->news_page .= '' . $subject . '
'; } $this->news_page .= $commentor . '

' . "\n"; $this->news_page .= '

' . $date_added . '

' . "\n"; $this->news_page .= '

' . "\n"; $this->news_page .= '
' . "\n"; $this->news_page .= '
' . "\n"; if ($html_text) { $this->news_page .= '

' . $comments . '

' . "\n"; } else { $this->news_page .= '

' . nl2br($comments) . '

' . "\n"; } $this->news_page .= '
' . "\n"; return true; } function articleCommentsLogin($legend, $text) { $this->news_page .= '
' . "\n"; $this->news_page .= ' ' . $legend . '' . "\n"; $this->news_page .= '

' . $text . '

' . "\n"; $this->news_page .= '
' . "\n"; $this->articleSplit(); return true; } function articleCommentsInput($form_url, $legend, $commentor_label, $commentor_input, $subject_label, $subject_input, $comments_label, $comments_input, $submit_input) { $this->news_page .= '
' . "\n"; $this->news_page .= ' ' . "\n"; $this->news_page .= '
' . "\n"; $this->news_page .= ' ' . $legend . '' . "\n"; $this->news_page .= ' ' . "\n"; $this->news_page .= ' ' . "\n"; $this->clearSplit(); $this->news_page .= ' ' . "\n"; $this->news_page .= '
' . "\n"; $this->news_page .= '

' . $submit_input . '

' . "\n"; $this->news_page .= '
' . "\n"; $this->articleSplit(); return true; } function archiveLink($archive_url, $archive_url_text) { $this->clearSplit(); $this->news_page .= '

' . $archive_url_text . '

' . "\n"; return true; } function archiveListBegin() { $this->clearSplit(); $this->splitSolid(); $this->news_page .= '

' . "\n"; return true; } function articleSplit() { $this->clearSplit(); $this->splitSolid(); $this->clearSplit(); return true; } function clearSplit() { $this->news_page .= '

' . "\n"; return true; } function splitSolid() { $this->news_page .= '

' . "\n"; return true; } function displayNewsPage($direct_output = true) { if ($direct_output) { echo $this->news_page; return true; } else { return $this->news_page; } } } ?>