cvs: smarty /docs/scripts generate_web.php
"Nuno Lopes" <[email protected]>
| Newsgroups | gmane.comp.php.cvs.smarty |
|---|---|
| Message-ID | <cvsnlopess1085329302@cvsserver> |
nlopess Sun May 23 12:21:42 2004 EDT
Modified files:
/smarty/docs/scripts generate_web.php
Log:
better processing of manual for the web: now it doesnt produce two<head>s etc...
#I HAVENT TEST THIS. can anybody test this on-line please? thanks
http://cvs.php.net/diff.php/smarty/docs/scripts/generate_web.php?r1=1.2&r2=1.3&ty=u
Index: smarty/docs/scripts/generate_web.php
diff -u smarty/docs/scripts/generate_web.php:1.2 smarty/docs/scripts/generate_web.php:1.3
--- smarty/docs/scripts/generate_web.php:1.2 Tue Mar 23 13:21:20 2004
+++ smarty/docs/scripts/generate_web.php Sun May 23 12:21:42 2004
@@ -18,19 +18,19 @@
| Small hack to generate the manual for the web |
+----------------------------------------------------------------------+
- $Id: generate_web.php,v 1.2 2004/03/23 18:21:20 nlopess Exp $
+ $Id: generate_web.php,v 1.3 2004/05/23 16:21:42 nlopess Exp $
*/
set_time_limit(0);
$search = array(
- '<BODY',
- '</BODY'
+ '/(<HTML.*<META.*HTTP-EQUIV="Content-type".*charset=(.*)".*<BODY[^>]+>)/mSs',
+ '/(<\/BODY\s*><\/HTML\s*>)/mS'
);
$replace = array(
- '<?php if(!isset($_GET["print"]) && !strstr($_SERVER["REQUEST_URI"],"/print/")) { commonHeader(); } ?><BODY',
- '<?php if(!isset($_GET["print"]) && !strstr($_SERVER["REQUEST_URI"],"/print/")) { commonFooter(); } ?></BODY'
+ '<?php if(!isset($_GET["print"])&&!strstr($_SERVER["REQUEST_URI"],"/print/")){ini_set("default_charset","\2");commonHeader();}else{ ?> \1 } ?>',
+ '<?php if(!isset($_GET["print"])&&!strstr($_SERVER["REQUEST_URI"],"/print/")){commonFooter();}else{ echo "</body></html>";} ?>'
);
if ($dir = opendir('phpweb')) {
@@ -40,9 +40,10 @@
if(substr($file, -4) == '.php') {
$text = file_get_contents('phpweb/' . $file);
- $text = str_replace($search, $replace, $text);
- $handler = fopen('phpweb/' . $file, 'w+');
+ $text = preg_replace($search, $replace, $text);
+
+ $handler = fopen('phpweb2/' . $file, 'w+');
fputs($handler, $text);
fclose($handler);
}
--
Smarty CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php