Pergunta

I'm trying replace links with ob_get_contents(), but I'm using another function to replace head tags like title and etc ... With this code I get double header, index and footer.

Function

function self_urls_convert($html) { 
  $html = str_replace('index.php','index',$html);
  $html = str_replace('about_us.php','about_us',$html);
  return $html;
}

Footer

$output = ob_get_contents();

if (ob_get_length() !== FALSE){
  ob_end_clean();
}

echo self_urls_convert($output);
echo $tags->handle_output($output); 

if (ob_get_length() !== FALSE){
  ob_end_flush();
}
Foi útil?

Solução

You get everything twice because you echo it twice.

$output = self_urls_convert($output);
$output = $tags->handle_output($output);
echo $output;

should work

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top