From: SourceForge.net <no...@so...> - 2007-11-09 21:31:40
|
/mod/quotes item #969671, was opened at 2004-06-09 10:02 Message generated for change (Comment added) made by grizzly-adams You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=681719&aid=969671&group_id=81360 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Tony Miller (cl00bie) Assigned to: Tony Miller (cl00bie) Summary: RFE: List Quotes Initial Comment: Allow the user to look at a list of the quotes. ---------------------------------------------------------------------- Comment By: grizzly adams (grizzly-adams) Date: 2007-11-09 15:31 Message: Logged In: YES user_id=1933823 Originator: NO Here's a function to do this (add to class/Quotes.php): function _list() { $sql = "SELECT label, quote FROM mod_quotes_items WHERE hidden = 0 ORDER BY RAND()"; $results = $GLOBALS["core"]->getAllAssoc($sql, TRUE); $listTags = array(); $rowCounter = 0; foreach($results as $result) { $rowTags = array(); $rowTags["ROW_CLASS"] = ($rowCounter % 2 ? " class=\"bg_light\"" : " class=\"bg_medium\""); $rowTags['LABEL'] = $result['label']; $rowTags['QUOTE'] = stripslashes($result['quote']); $listTags["LIST_ITEMS"] .= PHPWS_Template::processTemplate($rowTags, "quotes", "row.tpl"); $rowCounter++; } $title = $_SESSION["translate"]->it("Quotes"); PHPWS_Layout::addPageTitle($title); $content = PHPWS_Template::processTemplate($listTags, "quotes", "list.tpl"); $GLOBALS['CNT_quotes_list']['title'] = $title; $GLOBALS["CNT_quotes_list"]["content"] .= $content; }// END FUNC _list The action() function in class/Quotes.php also needs to be updated. Add this to the switch(): case "list": $content .= $this->_list(); break; Then, to view the list, use this link: http://{YOUR_WEBSITE}/index.php?module=quotes"ES_OP=list ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=681719&aid=969671&group_id=81360 |