There’s two ways to handle this. One is to have your frameset page be written in PHP or another server-side language, and pass a variable to it in the request, so your frameset knows which page to load into the frame or frames. The other is to do the same thing, except with JavaScript. This second method has all sorts of down-sides, so I don’t recommend it as highly as the PHP.
In either case, your URLs that you use to load the frameset + non-default page would look nearly the same:
http://example.com/frameset.php?frame1=somepage.html
or
http://example.com/frameset.html?frame1=somepage.html
Here’s how to build the PHP one. (I assume, with some degree of certainty, that your server supports PHP. Most do.)
You’ve already built a frameset in Freeway. So you have the local equivalent of frameset.html already. If you were to look inside the source code for this file, you would find that it doesn’t have all that much inside it, just references to other pages and some instructions for how to assemble the composite page.
What you need to do is translate the automatic URLs that Freeway has made for you into references to programming variables. Let’s keep this simple, and say that you’ve got a basic top-banner, bottom-stretchy-area style frameset, and you’re only interested in loading the content into the bottom frame. The top frame will always be the same.
Open up your Frames palette, and double-click on the bottom frame there. You will see a dialog very similar to the Hyperlink dialog, where you may choose which page will load into that frame by default. Click over to the External tab, and enter the following:
<?php echo $frame_src; ?>
Okay out of the dialog. Your bottom frame will have disappeared, replaced by some text indicating the URL. At this point, you should also use the Page Inspector to change the filename of your frameset from frameset.html to frameset.php. This will not change the Title of your page, only the Filename.
Now open the Page / HTML Markup dialog on the frameset page and move to the Before HTML section. Enter the following code there:
<?php
$frame_src = 'your_default_page.html';
if(isset($_GET['frame1'])){
if(file_exists(dirname(__FILE__) . '/' . $_GET['frame1'])){
$frame_src = $_GET['frame1'];
}
}
?>
Now you cannot preview this frameset locally any more, you will have to upload it to your server to see anything, because PHP requires the server to read and interpret the instructions before sending HTML to your browser.
To use this, you would simply create URLs that include the filename of the page you want to load into the bottom frame (and you’d have to make sure that page is in the same folder as the frameset file itself – there’s a strong security measure in the code above, meant to keep someone from viewing http://example.com/frameset.php?frame1=/etc/passwd
or something equally embarrassing. You’ll have to enter those URLs manually, using the External tab of the Hyperlink palette.
Let us know how it goes, if this works or not.
Walter
freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options