PDA

View Full Version : Creating Pages "On the Fly"


peterinwa
03-25-2003, 04:03 PM
Based on conditions stored in cookies, I create my pages "on the fly" and they look different accordingly. I have been doing this for years and it works great.

My (minor) problem now is that my new page is so complex that it takes a second to create. During this time it can't display as it hasn't been created so the browser displays a notice that the page doesn't exist. Then a second later the page appears in place of the warning.

I solved this by creating a simple page:

<html><head></head>
<body bgcolor='#999999'>
</body></html>

that displays (flashes, really) for that second.

This works fine, you just see a blank, gray page for a second.

Is there a way to avoid this? If not... gee... I could put some fun stuff on that page to tease for the second!?!

joh6nn
03-25-2003, 05:05 PM
without seeing the method you're using for writing the pages on the fly, i'm gonna take a guess, and say that there's no way to get rid of that brief second wait. so, maybe make that intermediary page look like this:

<html><head></head>
<body bgcolor='#999999'>
<span style="position: absolute; left: 45%; top: 48%;">Loading...</span>
</body></html>

brothercake
03-25-2003, 05:14 PM
I don't understand why the error page is there at all ... what kind of process are you using to generate a page?

Because, say you're using server-side scripting like PHP, and you request a dynamic page called "page.php", a browser *should not* display an intermediate error page, or anything at all, until the page is either displayed (or cannot be displayed at all) or the whole request times out.

Can you give more info on the process you're using? It sounds to me like there's something screwy going on with your server.

Unless ... you're not using the 'clean URLs' approach that uses mod_rewrite on 404 error codes are you? because that approach is fundamentally flawed IMO ... I can give more info on request.

peterinwa
03-25-2003, 05:24 PM
Thanks joh6nn.

For brothercake, here's my index.html:

<html>
<head>
<title>Calorie Counter...
</head>
<frameset rows="100%,*,*" frameborder=no border=0 framespacing=0>
<frame name="image" src="index_image_food.html" scrolling=yes>
<frame name="create" src="index_create_food.html" scrolling=no>
</frameset>
</html>

I store my functions and create the page from "create."

c+=... code for page...
c+="</td></tr></table></center></body></html>";

parent.image.document.write(c);
parent.image.document.close();}

Thanks!

brothercake
03-25-2003, 05:38 PM
Oh right - you're writing across frames using javascript ... [cake notices what forum he's in ...]

Forget what I said then ... I was assuming some server-side process had gone wrong. In which case I think Joh6nn's is the best solution.

peterinwa
03-25-2003, 05:50 PM
Sorry, I wasn't clear.

I only got the error frame before I created a dummy page to appear for the second while the actual page was being created.

Sounds like I'm doing things okay for my limited client-side capabilities.

Thanks, Peter

P.S.

While I get thousands of visitors daily, my website is just a hobby and I can have fun. I think I'll put some funny picture up for that second. (Well, maybe not. Then I'd have to answer dozens of e-mails daily asking what it was.)

glenngv
03-26-2003, 03:38 AM
try:

<html>
<head>
<title>Calorie Counter...
</head>
<frameset rows="100%,*,*" frameborder=no border=0 framespacing=0>
<frame name="image" src="about:blank" scrolling=yes>
<frame name="create" src="index_create_food.html" scrolling=no>
</frameset>
<script language="javascript">
c+=... code for page...
c+="</td></tr></table></center></body></html>";

top.frames["image"].document.write(c);
top.frames["image"].document.close();}
</script>
</html>