Skip to content

Instantly share code, notes, and snippets.

@psiborg
Created January 6, 2012 08:35
Show Gist options
  • Select an option

  • Save psiborg/1569723 to your computer and use it in GitHub Desktop.

Select an option

Save psiborg/1569723 to your computer and use it in GitHub Desktop.
PHP Object Template
<?php
/* ===========================================================================
* $Id$
*
* @fileoverview
*
*
* @author Jim Ing (@jim_ing)
* ===========================================================================
*/
/**
* @desc
*
*/
class Base {
public $lang = ''; // language code (en|fr)
//------------------------------------------------------------------------
/**
* @desc
* Constructor.
*/
function __construct ($lang) {
global $_CONFIG;
if ($lang) {
$this->lang = $lang;
}
else if ($_CONFIG['lang']) {
$this->lang = $_CONFIG['lang'];
}
}
/**
* @desc
*
*/
public function hello ($str) {
try {
header('Content-Type: text/html');
header('Content-Language: ' . $this->lang);
echo 'Hello ' . $str . PHP_EOL;
}
catch (Exception $e) {
header('Content-Type: text/plain');
die('Exception: ' . $e->getMessage());
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment