Login   Register  
PHP Classes
elePHPant
Icontem

File: examples/newscountBox.lib

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2 years ago
Size: 571 bytes
 

Contents

Class file image Download
<?php

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

class newscountBox extends Box
{
  public function __construct()
  {
    parent::__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);
  }

}

?>