vurentjie
Sep 19th 2008, 3:59 pm
Hi,
I have been trying to come up with a expression that will grab the content of a html page, but only from opening body tag to its closing counterpart. I would really appreciate feedback on this, as it is about my fifth attempt. I have testing them all evening on different pages, to check the reliablity, this one works on all pages I have tested, but because some of my earlier attempts worked for some pages and not others I am a bit unsure, so here it is
preg_match_all("/<\s*(body)((\s*(.)*[^a-zA-z0-9]\s*)*)(\/)(body)\s*>/i", $file, $matches);
I am using this with a site editor module I am building, I would like to be able to gather the current site layout with php before sending it through to the javascripts as I have other database actions that could be handled better this way, but I do have a javascript workaround that is not as pretty if this becomes to risky.
Advice please!
I have been trying to come up with a expression that will grab the content of a html page, but only from opening body tag to its closing counterpart. I would really appreciate feedback on this, as it is about my fifth attempt. I have testing them all evening on different pages, to check the reliablity, this one works on all pages I have tested, but because some of my earlier attempts worked for some pages and not others I am a bit unsure, so here it is
preg_match_all("/<\s*(body)((\s*(.)*[^a-zA-z0-9]\s*)*)(\/)(body)\s*>/i", $file, $matches);
I am using this with a site editor module I am building, I would like to be able to gather the current site layout with php before sending it through to the javascripts as I have other database actions that could be handled better this way, but I do have a javascript workaround that is not as pretty if this becomes to risky.
Advice please!