Nieuw lid |
|
Dit is de volledige functie: gewoon ob_start("titels") en flushen. En natuurlijk deze pagina includen.
<?php
function titels($buffer){
$tekst=explode("\n",$buffer);
foreach($tekst as $regel){
if(preg_match('~\[titel](.*?)\[/titel]~s',$regel,$titels_p_r)){
$i=1;
while($i<count($titels_p_r)){
$titels[]=$titels_p_r[$i];
$i+=2;
}
}
}
if (count($titels)>0)
$titel=array_pop($titels).' - Mijn Site';
else
$titel='Mijn Site';
$head='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>';
$head.= "\n<script language=\"javascript\">document.title=\"".$titel."\"</script>\n";
return $head.preg_replace('~\[titel](.*?)\[/titel]~s','',$buffer);
}?>
<?php function titels($buffer){ foreach($tekst as $regel){ if(preg_match('~\[titel](.*?)\[/titel]~s',$regel,$titels_p_r)){ $i=1; while($i<count($titels_p_r)){ $titels[]=$titels_p_r[$i]; $i+=2; } } } else $titel='Mijn Site'; $head='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head>'; $head.= "\n<script language=\"javascript\">document.title=\"".$titel."\"</script>\n"; return $head.preg_replace('~\[titel](.*?)\[/titel]~s','',$buffer); }?>
|