PHP Classes

File: examples/newscountBox.lib

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of philippe thomassigny  >  Box Model  >  examples/newscountBox.lib  >  Download  
File: examples/newscountBox.lib
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Box Model
Create Web applications based on boxes
Author: By
Last change:
Date: 3 years ago
Size: 571 bytes


Class file image Download

// Gets the quantity of news of the category
// entry: none
// exit: quantity
// params: category of newss

class newscountBox extends Box
  public function __construct()

    $this->addInput('CATEGORY', Box::STRING, 'main');
    $this->addOutput('quantity', Box::INTEGER);

  public function run()
    // Simulates a connection to a database and gets back
    // 7 news

    // Here we should make a query like
    // select count(*) from news where status='published';

    $this->setOutputData('quantity', 7);