interactive course site

I wish to make a site where people can read a given lesson and fill in their
responses to a few questions.
They would then be able to print this lesson and response as a record for
themselves.

As far as I know this would work with any form text field left dumb.
(Is that so on PCs too?)

At this stage I don’t need them to be ‘remembered’ but it might be nice if
the text fields they fill in were put into a printable page that did not
have the sidebar navigation and headers etc but did have their input nicely
formatted.

I don’t need to keep any record of inputs or do anything with it - this is
solely for the participant to use.

Would this be a simple thing to achieve?
Any pointers or guidance on this will be gratefully received.

all the best
Brian


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

You can do a lot of this with CSS. What you will need to do is create
either a print stylesheet or add a print section to your page’s
styles. The way I do this for the Online Library of Liberty is to
have a separate stylesheet for print, and in it simply “turn off” the
things I don’t want to see, like this:

#item1 { display: none; }

You would find the item’s id using the Inspector in Freeway, whatever
the Name that is reported when you click on the element on your page,
simply prepend a octothorpe (type-geek-speak for a # sign) to it to
make it an ID in CSS.

Using this method, you can simply cause elements to not appear during
printing. Of course, this approach means that you need to use another
tool to create this print-only style sheet, and then you need to add
it to your page by using the Page > HTML Markup dialog in the Before /
HEAD section, adding something like this:

<link rel="stylesheet" type="text/css" media="print" href="/path/to/ 

your/print.css" />

If you want to do it all in Freeway, then you can code the entire
print CSS in the same part of the HTML Markup dialog. Enter something
like this:

<style type="text/css">
	@media print {
		#item1 { display: none; }
		...
	}
</style>

You will need to fill that out with all the IDs of the elements you
want to hide.

The other way to manage this is to actually go the extra mile and
create a form handler that simply prints out a nice looking print
version of the form submission. This is probably the same amount of
work, but it potentially will be easier, because instead of having to
create a layout that is flexible enough to permit parts of it to be
turned off while still looking “normal”, you can simply create your
print styled page on the fly, and make it as simple and neat as
possible from the start.

If you have access to PHP on your server, please let me know and I
will point you to some examples of what to do.

Walter
On Jan 29, 2008, at 9:35 AM, Brian Steere wrote:

At this stage I don’t need them to be ‘remembered’ but it might be
nice if
the text fields they fill in were put into a printable page that
did not
have the sidebar navigation and headers etc but did have their
input nicely
formatted.

I don’t need to keep any record of inputs or do anything with it -
this is
solely for the participant to use.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

So many ways to skin the cat!

In the trust that answers often serve more than l’il ol’ me I will state
that I will choose a host with PHP.

I note that my linklok scripts populate a page template with values - so I
am aware that these functionalities are enacted via PHP - but the how to is
less apparent.

It may be that the CSS isn’t too far out for me to approach.

Is the form handler the same skinning technique as via PHP?

In Gratitude

Brian

Walter Lee Davis said recently:

You can do a lot of this with CSS. What you will need to do is create
either a print stylesheet or add a print section to your page’s
styles. The way I do this for the Online Library of Liberty is to
have a separate stylesheet for print, and in it simply “turn off” the
things I don’t want to see, like this:

#item1 { display: none; }

You would find the item’s id using the Inspector in Freeway, whatever
the Name that is reported when you click on the element on your page,
simply prepend a octothorpe (type-geek-speak for a # sign) to it to
make it an ID in CSS.

Using this method, you can simply cause elements to not appear during
printing. Of course, this approach means that you need to use another
tool to create this print-only style sheet, and then you need to add
it to your page by using the Page > HTML Markup dialog in the Before /
HEAD section, adding something like this:

If you want to do it all in Freeway, then you can code the entire
print CSS in the same part of the HTML Markup dialog. Enter something
like this:

@media print { #item1 { display: none; } ... }

You will need to fill that out with all the IDs of the elements you
want to hide.

The other way to manage this is to actually go the extra mile and
create a form handler that simply prints out a nice looking print
version of the form submission. This is probably the same amount of
work, but it potentially will be easier, because instead of having to
create a layout that is flexible enough to permit parts of it to be
turned off while still looking “normal”, you can simply create your
print styled page on the fly, and make it as simple and neat as
possible from the start.

If you have access to PHP on your server, please let me know and I
will point you to some examples of what to do.

Walter
On Jan 29, 2008, at 9:35 AM, Brian Steere wrote:

At this stage I don’t need them to be ‘remembered’ but it might be
nice if
the text fields they fill in were put into a printable page that
did not
have the sidebar navigation and headers etc but did have their
input nicely
formatted.

I don’t need to keep any record of inputs or do anything with it -
this is
solely for the participant to use.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Rrrrow!!

The way that I would do this with PHP would be to have a very simple
function on the server to catch and re-display the form submission.
To make it easy, I would simply use the $_REQUEST global as the input
(since that catches POST, GET, and SESSION in one whack).

Make a new text document (in a proper text editor, like BBEdit,
TextWrangler, Coda, TextMate, SubEthaEdit – basically anything with
Geek Cred).

If you are copying this from Mail, be sure that every line below
between the php start end end tags ends in either a curly brace or a
semicolon. Mail loves to line-wrap text, and PHP doesn’t like that so
much.

If you are copying from the Web interface, pay attention to the quote
marks. The smart punctuation module on the Web likes to curl the
quotes for better typographical presentation. It’s supposed to leave
the contents of code blocks alone, but it’s sometimes a little too
helpful and you end up with pretty, but non-functional code.

<?php
	$input = array_map('strip_tags',$_REQUEST);
	$input = array_map('trim',$input);
	$output = "";
	foreach($input as $key=>$val){
		if($key != 'submit' && !empty($val)){
			$out .= ucwords(str_replace('_',' ',$key));
			$out .= ': ' . $val . '<br />;
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Form Results - Print This Page</title>
</head>
<body>
<div>
<?=$out?>
</div>
</body>
</html>

To use this handler, save it on your server in your Web root
somewhere with a file-type extension of .php, and in Freeway, point
your form at it as the Action. So if you called it ‘handler.php’, and
you put it in the same folder on the server as Freeway publishes the
form page, in the Freeway Form Setup dialog you would enter
‘handler.php’ in the Action field.

You can set the Method to either POST or GET. GET is useful while
debugging, because you can see the variables that are being sent
directly in the URL field of the browser. POST is better in
production because some (cough, Microsoft, cough) browsers don’t do
well with very long GET strings. There is a limit to POST, but it’s
so high as to be unreachable in practice.

Again in Freeway, make sure that your Submit button is named
‘submit’ (the Value is what sets the text on the button, but I have
deliberately hidden any field named ‘submit’ in this script). Each
form field that you want to be displayed on the print view should be
named in lower-case with underscores for spaces, like
‘some_field_name’. The script will remove the underscores and
Uppercase the first letter of each word, so it would display as ‘Some
Field Name’.

That’s it. Upload your Freeway document, and try it out on the server.

Note that this script simply echoes whatever was entered. It does no
validation of any kind, and does rudimentary cleansing of the input
to avoid basic server attacks.

Hope this helps,

Walter

On Jan 29, 2008, at 11:34 AM, Brian Steere wrote:

So many ways to skin the cat!

In the trust that answers often serve more than l’il ol’ me I will
state
that I will choose a host with PHP.

I note that my linklok scripts populate a page template with values

  • so I
    am aware that these functionalities are enacted via PHP - but the
    how to is
    less apparent.

It may be that the CSS isn’t too far out for me to approach.

Is the form handler the same skinning technique as via PHP?

In Gratitude

Brian


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thank you Walter
I will have a go at this and come back if I hit a false ceiling.
:wink:

all the best
Brian

Walter Lee Davis said recently:

Rrrrow!!

The way that I would do this with PHP would be to have a very simple
function on the server to catch and re-display the form submission.
To make it easy, I would simply use the $_REQUEST global as the input
(since that catches POST, GET, and SESSION in one whack).

Make a new text document (in a proper text editor, like BBEdit,
TextWrangler, Coda, TextMate, SubEthaEdit – basically anything with
Geek Cred).

If you are copying this from Mail, be sure that every line below
between the php start end end tags ends in either a curly brace or a
semicolon. Mail loves to line-wrap text, and PHP doesn’t like that so
much.

If you are copying from the Web interface, pay attention to the quote
marks. The smart punctuation module on the Web likes to curl the
quotes for better typographical presentation. It’s supposed to leave
the contents of code blocks alone, but it’s sometimes a little too
helpful and you end up with pretty, but non-functional code.

<?php $input = array_map('strip_tags',$_REQUEST); $input = array_map('trim',$input); $output = ""; foreach($input as $key=>$val){ if($key != 'submit' && !empty($val)){ $out .= ucwords(str_replace('_',' ',$key)); $out .= ': ' . $val . '
; } } ?> Form Results - Print This Page
<?=$out?>

To use this handler, save it on your server in your Web root
somewhere with a file-type extension of .php, and in Freeway, point
your form at it as the Action. So if you called it ‘handler.php’, and
you put it in the same folder on the server as Freeway publishes the
form page, in the Freeway Form Setup dialog you would enter
‘handler.php’ in the Action field.

You can set the Method to either POST or GET. GET is useful while
debugging, because you can see the variables that are being sent
directly in the URL field of the browser. POST is better in
production because some (cough, Microsoft, cough) browsers don’t do
well with very long GET strings. There is a limit to POST, but it’s
so high as to be unreachable in practice.

Again in Freeway, make sure that your Submit button is named
‘submit’ (the Value is what sets the text on the button, but I have
deliberately hidden any field named ‘submit’ in this script). Each
form field that you want to be displayed on the print view should be
named in lower-case with underscores for spaces, like
‘some_field_name’. The script will remove the underscores and
Uppercase the first letter of each word, so it would display as ‘Some
Field Name’.

That’s it. Upload your Freeway document, and try it out on the server.

Note that this script simply echoes whatever was entered. It does no
validation of any kind, and does rudimentary cleansing of the input
to avoid basic server attacks.

Hope this helps,

Walter

On Jan 29, 2008, at 11:34 AM, Brian Steere wrote:

So many ways to skin the cat!

In the trust that answers often serve more than l’il ol’ me I will
state
that I will choose a host with PHP.

I note that my linklok scripts populate a page template with values

  • so I
    am aware that these functionalities are enacted via PHP - but the
    how to is
    less apparent.

It may be that the CSS isn’t too far out for me to approach.

Is the form handler the same skinning technique as via PHP?

In Gratitude

Brian


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options