Sha256: 63ba58fa71adf7a507a267b3df15de875057ab70215e454ad5a78aad0884357c

Contents?: true

Size: 781 Bytes

Versions: 5

Compression:

Stored size: 781 Bytes

Contents

<?php
function template_file($f) {
  if ($f === null) {
    $f = basename($_SERVER['PHP_SELF'], '.php');
  }
  if ($f[0] == ':') {
    $f = substr($f, 1);
    $dir = TPL_ROOT;
  } else {
    $dir = TPL_DIR;
  }
  return "$dir/$f.php";
}

function display_template($__tpl__, $locals = array()) {
  global $_TPL;
  extract($_TPL);
  require template_file($__tpl__);
}

function render_template($__tpl__, $locals = array()) {
  ob_start();
  display_template($__tpl__, $locals);
  return ob_get_clean();
}

function get_template_var($k, $d = null) {
  if (isset($GLOBALS['_TPL'][$k])) {
    return $GLOBALS['_TPL'][$k];
  } else {
    return $d;
  }
}

function set_template_var($k, $v) {
  $GLOBALS['_TPL'] = $v;
}

function set_template_ref($k, &$v) {
  $GLOBALS['_TPL'] = &$v;
}
?>

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
jaz303-site-skel-0.1.0 layouts/php/_offsite/lib/template.php
jaz303-site-skel-0.1.1 layouts/php/_offsite/lib/template.php
jaz303-site-skel-0.1.2 layouts/php/_offsite/lib/template.php
jaz303-site-skel-0.1.3 layouts/php/_offsite/lib/template.php
site-skel-0.1.4 layouts/php/_offsite/lib/common/template.php