Ich habe mit meinem kleinen Parser ein kleines Problem. Er streikt bei diesen Sachen hier:
Fehlermeldung:
Warning: preg_replace_callback() requires argument 2, 'getContent', to be a valid callback in C:\Server\www\ws\inc\class.inc.php on line 37
/* inc/class.inc.php */
/* index.php */
/* main.html */
Fehlermeldung:
Warning: preg_replace_callback() requires argument 2, 'getContent', to be a valid callback in C:\Server\www\ws\inc\class.inc.php on line 37
/* inc/class.inc.php */
Code:
<?php
class Parser
{
/* ... */
/* getFile() - liest die .html Datei aus */
/* Display() - ruft Standards() auf und return´d die geparste Datei */
function getContent ($file)
{
ob_start();
include($file);
return ob_get_content();
}
function Standards ()
{
$output = $this->input;
$output = preg_replace('/{date:(.+)}/e', 'date(\'$1\');', $output);
$output = preg_replace_callback('/{include:(.+)}/e', 'getContent', $output); // line 37
$this->input = $output;
return $this->input;
}
/* ... */
}
?>
Code:
<?php
include('inc/class.inc.php');
$main = new Parser();
$main->getFile('main.html');
echo $main->Display();
?>
Code:
<html>
<head>
<title>test</title>
</head>
<body>
{include:test.html}
</body>
</html>

Kommentar