views:

16

answers:

0

I am trying to run preg_replace_callback, or an ob_start(), extract() combination through a subdirectory. Something along the lines of these functions

<?php

/**
 * Execute a PHP template file and return the result as a string.
 */
function apply_template($tpl_file, $vars = array(), $include_globals = true)
{
  extract($vars);

  if ($include_globals) extract($GLOBALS, EXTR_SKIP);

  ob_start();

  require($tpl_file);

  $applied_template = ob_get_contents();
  ob_end_clean();

  return $applied_template;
}

?>

A similar example is http://stackoverflow.com/questions/292395/php-templating

Is there a way I can get a list of the occurrences of each variable and their line numbers from the functions as well.

The above examples may not have that facility, but is there one that can?