Menu

#4 RFE: List Quotes

open
None
5
2004-09-25
2004-06-09
Tony Miller
No

Allow the user to look at a list of the quotes.

Discussion

  • Tony Miller

    Tony Miller - 2004-06-09
    • labels: 623443 --> 603052
     
  • Tony Miller

    Tony Miller - 2004-06-09
    • assigned_to: nobody --> cl00bie
     
  • Mike Noyes

    Mike Noyes - 2004-06-11
    • labels: 603052 -->
    • assigned_to: cl00bie --> nobody
     
  • Mike Noyes

    Mike Noyes - 2004-09-25
    • assigned_to: nobody --> cl00bie
     
  • grizzly adams

    grizzly adams - 2007-11-09

    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&QUOTES_OP=list

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.