template question - Joomla! Forum - community, help and support


i creating module shows times in other parts of world. have pieces of module working except when draw table via pattemplate see same time time. if print array see correct times stored. can tell me doing wrong here? here sample of code:

/**
* @version 1.0 $
* @package timezones
* @copyright (c) 2006 donovan makund
* @license http://www.gnu.org/copyleft/gpl.html gnu/gpl
*/
/** ensure file being included parent file */
defined( '_valid_mos' ) or
    die( 'direct access location not allowed.' );
 
// load pattemplate library
require_once( $mosconfig_absolute_path
    . '/includes/pattemplate/pattemplate.php' );
     
include('lib/tzphp-0.1.2/tz.php');

  $countries = array(  "suva"          =>  'pacific/fiji',
                        "sydney"        =>  'australia/sydney',
                        "melbourne"    =>  'australia/melbourne',
                        "adelaide"      =>  'australia/adelaide',
                        "perth"        =>  'australia/perth',
                        "brisbane"      =>  'australia/brisbane',
                        "auckland"      =>  'pacific/auckland',
                        "wellington"    =>  'pacific/auckland',
                        "honolulu"      =>  'pacific/honolulu',
                        "los angeles"  =>  'america/los_angeles',
                        "san francisco" =>  'america/los_angeles',
                        "seattle"      =>  'america/los_angeles',
                        "new york"      =>  'america/new_york',
                        "vancouver"    =>  'america/vancouver',
                        "montreal"      =>  'america/montreal',
                        "toronto"      =>  'america/toronto',
                        "london"        =>  'europe/london'
                        );

  $time = time();
  $results = array();
  $x = 0;

  foreach ($countries $city => $zone) {
    $there = tz_localtime($time, $zone);

    $zones = sprintf("%02d/%02d/%d %02d:%02d:%02d\n", $there[4]+1, $there[3], $there[5]+1900, $there[2], $there[1], $there[0]).($there[9]?'dst':'');

    $result = array("city" => $city, "zone" => $zones);

    $results[$x++] = $result;
  }

// display data

// create template
$tmpl =& patfactory::createtemplate( '', false, false );

// set path html files
$tmpl->setroot( dirname( __file__ ) . '/mod_timezones' );

// load template
$tmpl->readtemplatesfrominput( 'default.html' );

// add 'rows' rows template prefix

$tmpl->addrows("results", $results);

// output template
$tmpl->displayparsedtemplate( 'timezones' )

?>

here results show:

city  zone 
suva  12/28/2006 16:26:45 
sydney  12/28/2006 16:26:45 
melbourne  12/28/2006 16:26:45 
adelaide  12/28/2006 16:26:45 
perth  12/28/2006 16:26:45 
brisbane  12/28/2006 16:26:45 
auckland  12/28/2006 16:26:45 
wellington  12/28/2006 16:26:45 
honolulu  12/28/2006 16:26:45 
los angeles  12/28/2006 16:26:45 
san francisco  12/28/2006 16:26:45 
seattle  12/28/2006 16:26:45 
new york  12/28/2006 16:26:45 
vancouver  12/28/2006 16:26:45 
montreal  12/28/2006 16:26:45 
toronto  12/28/2006 16:26:45 
london  12/28/2006 16:26:45 






Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support