You are making the same mistake I see so many new web programmers make, you are getting confused about which pieces in the client-server system do what, and when.
Relax, and take a deep breath and forget what you think you know. Let's look at this situation logically:
Given the above facts, lets think about what happens when you enter a URL into your browser that points to a frameset containing some text and pictures.
The browser draws the empty frames (or at least prepares to) and then requests the documents specified in the frame tags: /frame1.html and /content/frame2.html.<HTML> <frameset rows=80%,> <frameset> <Frame src="/frame1.html"> </frameset> <frameset> <Frame src="/content/frame2.html"> </frameset> </frameset> </HTML>
In your case you are going to be using Mason to the magic URL to HTML transformation on the server side. So let's see what your components will generate: my_file.html
footer.html<HTML> <head><title>My File</title></head> <body><H1>This is my file.</H1></body> </HTML>
autohandler<hr> <p>This is my site. This site is mine. Ehem. I made it and it is mine +, this site that is.</p>
<HTML> <Frameset rows="80%,20%"> <Frameset> <Frame src="<% $m->call_next(%args) %>"> </Frameset> <Frameset> <Frame src="footer.html"> </Frameset> </Frameset> </HTML>
If you request my_file.html you will get:
Which will cause your browser to ask for footer.html. footer.html will come back as:<HTML> <Frameset rows="80%,20%"> <Frameset> <Frame src="<HTML> <head><title>My File</title></head> <body><H1>This is my file.</H1></body> </HTML>"> </Frameset> <Frameset> <Frame src="footer.html"> </Frameset> </Frameset> </HTML>
Which will in turn request footer.html again and you get an infinite number of broken frames. Not quite what you were looking for, I think.<HTML> <Frameset rows="80%,20%"> <Frameset> <Frame src="<hr> <p>This is my site. This site is mine. Ehem. I made it and it is mine +, this site that is.</p>"> </Frameset> <Frameset> <Frame src="footer.html"> </Frameset> </Frameset> </HTML>
Mason is a great way to avoid the need to use frames. Consider this autohandler and example components. Here's how the pieces should be laid out:
/ <-- This is the mason component root. |- html/ <-- This is Apache's document root. | |- autohandler | |- frame.html | \- index.html \- cmp/ \- footer.mas
footer.mas can be the exact same as the footer above. I won't repeat that here. Let's look at index.html:
Now for the autohandler:<h1>My Content</h1> <p>I am content content.</p> <%attr> title => 'Content' </%attr>
<HTML> <head><title>Content</title></head> <body> <% $m->call_next %> <& /cmp/footer.mas &> </table></body> </HTML>
A request for main.html will get html that looks like:
<HTML> <head><title><% $m->comp->attr('title') %></title></head> <body> <h1>My Content</h1> <p>I am content content.</p> <hr> <p>This is my site. This site is mine. Ehem. I made it and it is mine +, this sit +e that is.</p></td></tr> </body> </HTML>
If you must use a frameset, think about it some more, you probably don't. If you still must, then you need to make sure that your autohandler does not perform content wrapping on your frames file. Here's what that looks like:
<HTML> <Frameset rows="80%,20%"> <Frameset> <Frame src="/somedoc.html"> </Frameset> <Frameset> <Frame src="/somefooter.html"> </Frameset> </Frameset> </HTML> <%flags> interit => undef # Or you could use a special frames autohandler ins +tead of the normal one </%flags>
Remember that the documents called up by the frames will use mason's content wrapping and will be processed through any autohandlers that might apply.
Check out the Mason book that just came out. It is quite good. The online docs are also excellent. As a bonus, the folks on the mailing list are quite helpful, too. You can find out about all this stuff at MasonHQ.
PS, I haven't tested any of this code, I just wrote it off the top of my head, so you'll want to make sure I haven't mixed anything up. For example, I tend to use methods instead of attributes to handle things like the page title in the autohandler, but in this case (read the manual to see why) attribs are more than sufficient, so I may have goofed up the semantics for calling them and the way they behave in respect to inheritance. Read the developers manual, read it six or seven times. I had to before I really got some of the concepts right.
TGI says moo
In reply to Re: HTML::Mason and Frames
by TGI
in thread HTML::Mason and Frames
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |