"John W. Holmes" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Richard A. DeVenezia wrote: > [snip] > > I can do > > - site.com/info/template.html and get two alerts > > - site.com/info/content1.html and see a new text under H1 > > - site.com/info/slick.php/content1.html and get neither alert nor new text. > > - instead I get 4 browser (IE) 'problem alerts', I presume > > - 1. for not finding js1.js > > - 2. for not finding js2.js > > - 3. for not finding content1.js > > - 4. for not finding helloFromContent1() function > > I think you're confusing HTML. While the server understands > slick.php/content1.html, HTML probably doesn't and is looking for > slick.php/content1.html/js1.js (and the other files). > > > I don't want to change my SRC references to be site absolute, I want them > > relative. > > Well, I'm glad that's what you want, but how about using it anyhow > because it'll work. Like Chris said, you can use a function/variable to > get the complete path so it's really no extra work for you. > > -- > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals – www.phparch.com
Thanks for the response. I figured out what was happening slick.php/content.html has a relative href js1.js which means the browser is going to do a get on slick.php/js1.js Thus, slick has to differentiate between html and non-html. If non-html, just echo back the file contents. slick changed to article, contentPath can be placed in folder out of webs way, or if in webs way .htaccess can restrict access to original form content. <? list ($slash, $page) = explode ('/', $HTTP_SERVER_VARS['PATH_INFO']); if ($page == '') { // just in case, make sure things start out right redirect ('/javascript/article.php/index.html'); return; } $contentPath = './content/'; $template = $contentPath . 'article-template.html'; /* $f = fopen ('c:\\temp\\article.log', 'a'); fwrite ($f, "looking for $page.\n"); fclose ($f); */ $page = $contentPath . $page; if (!file_exists ($page)) { header ("HTTP/1.0 404 Not Found"); echo "<HTML><HEAD><TITLE></TITLE></HEAD><BODY><P>$page not found.</P></BODY></HTML>"; return; } $source = implode ("", file ($page)); // server does not want html, just send the stuff back unaltered. if (!preg_match("/html$/", $page)) { echo $source; return; } // html!, rip out the pieces and replace into template page $template = implode ("", file ($template)); preg_match ("|<HEAD.*?>(.*)?</HEAD>|is", $source, $head); // i insensitive, s newlines are a character preg_match ("|<TITLE.*>(.*)?</TITLE>|is", $head[1], $title); preg_match_all ("|(<SCRIPT.*?>.*?/SCRIPT>)|isU",$head[1], $script); // U ungreedy preg_match_all ("|(<STYLE .*>.*/STYLE>)|isU", $head[1], $style); preg_match_all ("|(<LINK .*>)|isU", $head[1], $link); preg_match ("|<BODY.*?>(.*)</BODY>|is", $source, $content); $title = isset($title [1]) ? $title[1] : ''; $script = isset($script [1]) ? implode ($script[1]) : ''; $style = isset($style [1]) ? implode ($style [1]) : ''; $link = isset($link [1]) ? implode ($link [1]) : ''; $content= isset($content[1]) ? $content[1] : ''; $html = preg_replace ( array ("/:title:/", "/:style:/", "/:script:/", "/:link:/", "/:content:/" ) , array ( $title , $style , $script , $link , $content ) , $template ); echo $html; function redirect($to) { $schema = $_SERVER['SERVER_PORT']=='443'?'https':'http'; $host = strlen($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']:$_SERVER['SERVER_NAME']; if (headers_sent()) return false; else { header("Location: $schema://$host$to"); exit(); } } ?> -- Richard A. DeVenezia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php