<?php ?> <!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> <title>Ble ble ble</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> <meta name="Title" content="Tytuł strony" /> <meta name="Description" content="Opis stronki." /> <meta name="KeyPhrase" content="sklep komputerowy" /> <meta name="Keywords" content="jakies slowa kluczowe" /> <meta name="robots" content="all" /> <meta name="googlebot" content="all" /> <meta http-equiv="creation-date" content="Mon, 05 Jun 2006 19:17:51 +0100" /> </head> <body> </body> </html> <?php $tresc = eregi_replace('<title>(.*)</title>','<title>Tekst z bazy danych taki jak ja chce</title>',$tresc); $tresc = eregi_replace('<meta name="Description" content="(.*)" />','<meta name="Description" content="opis strony w oparciu o słowa kluczowe" />',$tresc); $tresc = eregi_replace('<meta name="Keywords" content="(.*)" />','<meta name="Keywords" content="nowe słowa kluczowe" />',$tresc); ?>
Jako wynik otrzymuje
<!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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" /> <meta name="Title" content="Tytuł strony" /> <meta name="Description" content="opis strony w oparciu o słowa kluczowe" /> </head> <body> </body> </html>
wynika z tego, że są wykonywane tylko 2 pierwsze eregi_replace() a kod jest potem przycinany :/ Próbowałem w wyrażeniu zamienić (.*) na (.*?) ale to nic nie daje :/