Hallo zusammen,
ich nutze folgenden Code:
Code:
private function create_regex($params, $regex_flag = '', $php_filename = 'index')
{
$regex = "'(http://[^<>\"]*?/)" . $php_filename . "\.php";
if (!empty($params))
{
$first_param = true;
foreach ($params as $name => $chars)
{
if ($first_param)
{
$regex .= "\?$name=($chars)";
$first_param = false;
}
else
{
$regex .= "&(?:amp;)?$name=($chars)";
}
}
}
$regex .= "'" . $regex_flag;
return $regex;
}
// Aufruf
public function replace_mod_rewrite($code)
{
$url_in = array();
$url_out = array();
$url_in[] = $this->create_regex(array('page' => '(?!admin_)[a-z_]*', 'id' => '[0-9]+'), 'e');
$url_out[] = "'$1$2/$3/' . \$this->get_title_str('$2', $3) . '.html'";
return preg_replace($url_in, $url_out, $code);
}
Wie kann das denn so umgeschrieben werden, dass "preg_replace_callback" verwendet wird?
Ich bekomme es irgendwie nicht gebacken.
Grüße
Matze