Like noone seems to find something usefull to help me.. I've done the work
myself :)
I've tried this :
$eregstr="/<style[^>]*>([^<]|<[^\/]|<\/[^style]|<\/style[^>])*<\/style[^>]*>
/msi";
$data=preg_match_all($eregstr,$str,$matches);
$str=preg_replace($eregstr,"",$str);
$styles=implode("\n",$matches[0]);
$eregstr="/<head[^>]*>(.*)<\/head[^>]*>/si";
$str=preg_replace($eregstr,"<head>\\1".$styles."</head>",$str);
And, actually, it works fine..
Any other solution ? ( faster...??)
"Baroiller Pierre-Emmanuel" <[EMAIL PROTECTED]> a �crit dans le message
de news: [EMAIL PROTECTED]
> Hi everyone...
>
> I've got a little problem :
>
> I've got an html template, with javasript functions and stylesheets in
many
> places...
> This html template is made via a big big template handler i've done...
> All seems to work... But, now, I would like to clean this html page to
> procude a 'readable' page
> If got a page like this :
> <html>
> <head>
> </head>
> <body>
> xyxyxyxyxyx
> <script>
> function nb1() {}
> </script>
> yyyyyyyyyyyyyyyyy
> yyyyyyyyyyyyyy
> <style>
> .outter {}
> </style>
> </body>
> </html>
>
> And.. I would like to produce a page like this :
>
> <html>
> <head>
> <style>
> .outter {}
> </style>
> <script>
> function nb1() {}
> </script>
> </head>
> <body>
> xyxyxyxyxyx
> yyyyyyyyyyyyyyyyy
> yyyyyyyyyyyyyy
> </body>
> <html>
>
>
> Anyone have and idea ?
> I've tried with some preg_match_all() but... The only that work for me is
> '/<head[^>]*>(.*)<\/head[^>]*>/si' witch returns the head content...
(where
> I'll add style & script contents)..
> I've tried to change 'head' with 'script' or 'style' but.. It doesn't
> work...
> Like I'm not a regex guru ...I'm looking for help..
>
>
> Regards,
> P.E. Baroiller
>
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php