NPDS is designed to generate WWW content without your having any knowledge of HTML or Newtonscript but it's also able to act as a much more traditional HTTP server in that if Notes you store in your selected WWW folder are written in strict HTML**, you can have exact control of the formatting and appearance of those documents.
** NPDS automatically detects whether a page is HTML or plaintext by looking for the presence of any of the following tags: <HTML>, <HEAD>, <BODY>, <FRAMESET>. You can, of course, fool the parser with a phony tag, but why would you want to do that?
Although these Notes may be HTML files, they don't have to be named according to traditional file-naming protocols since NoteServ doesn't use the file name to retrieve a given Note (This Appendix provides an explanation of how NoteServ and NPDS handle filenaming)
Examples:
If you have a note about your train collection and it's written in HTML because you need a nicely formatted table of all the types of engines you have, you can name the Note "My Train Collection" and that's perfectly OK.Its URL when displayed in the list of Notes will be something like /html/123456$007.nsd where "123456$007.nsd" is a special identifier NPDS uses to retrieve that particular Note.
Now, there's a neat trick you can do here... the Note is actually a container for a HTML object. What this means is that you write out your HTML page, give it a title between the <TITLE></TITLE> tags, then turn around and give the Note that contains it another title, quite likely the same one you put in the HTML.
If you want to logically link these two titles, put the following Server Side Include (SSI) <NOTE_TITLE> in between the <TITLE> tags in the HTML and when the page is served, the Note title will be substituted into the space between TITLE tags.
In our "My Train Collection" example: A note containing the HTML document is made. In the HEAD of the HTML doc is this code: <TITLE><NOTE_TITLE></TITLE>. The Note is titled "My Trains Collection." Now when the page is served, the name of the Note is substituted in like so <TITLE>My Train Collection</TITLE>.
Serving Pages and Data from your Newton doesn't have to be a static experience. You can create living, dynamic documents by writing into your notes variables called Server Side Includes (SSI). These variables are captured when the Note is served and substituted with specific data. You can put in variables for things as mundane as your name and email address to things a bit cooler like your daily schedule! You can also use SSI to access the NPDS formatting preferences (Here's an example).
User Data | Content Variables | Preferences | Paths
USR_NAME: Name of Current Owner |
USR_ADDR: Current Street Address |
USR_CITY: Current City |
USR_POST: Postal Zone |
USR_REGION: Current State/Province |
TIME: Current Date/Time |
USR_TELE: Default Telephone |
EMAIL: Current Default Email Address |
|
NOTE_LIST: List of Notes Filed in your selected WWW folder |
POST_LIST: List of Notes posted via the WWW |
NOTE_POST: Insert a link to /html/postnote.html where you
can post Notes to your Newton from a browser. |
NAME_SEARCH: Inserts a form for searching the Names database. |
AGENDA_DAY: Inserts a table containing the day's Events, Meetings, ToDos. |
NOTE_SEARCH: Inserts a form for searching the Notepad and returning a ranked list of hits. |
NOTE_TABLE: Table view of Notes sorted in ascending order by creation date |
POST_TABLE: Table view of WWW-posted Notes sorted in ascending order by creation date |
EVERY_TABLE: Table view of Both WWW-posted and Your Notes sorted in ascending order by creation date |
EVERY_LIST: List of Both WWW-posted and Your Notes |
|
|
NPDS-Wide Preference Variables
DEF_FONT: Font face defined as default |
DEF_SIZE: Default Font Size |
|
DEF_COLR: Background color |
HI_COLR: Preferred Background Highlight color |
COUNTER: Hit Counter |
HOME: Inserts a hyperlink to the page defined by admin as the "Home" page. |
INSULT: This is a special treat for you, Thou artless, beef-witted hedge pig. |
MOTD: Admin's Message of the day to his/her visitors |
NOTEPAD: Returns a link to NoteServ's /html/index.html |
CALENDAR: Returns a link to DateServ's /dates/index.html |
CARDFILE: Returns a link to the CardFile Server default page /cards/index.html |
PAGER: Returns a link to WebPager's form-based paging interface (/pager/index.html) |
GIFS: Returns a link to the /gifs/ virtual folder. |
MAILBOX: Will return a link to the Inbox Browser (Not available yet) |
To use any of these extensions, enclose them in < > and you'll be set. These can be used anyway that the data returned from them can be, so feel free to experiment!
SSI Example: You want your HTML pages to use the Default font specified in the NPDS Setup application. To do this, add this code to your HTML: <FONT FACE=<DEF_FONT>>. It'll be substituted as <FONT FACE="Times New Roman"> (or whatever you've chosen as default) when the page is served up. If you change the Default font, the font used in the display fo this HTML page will change, too. This si actually cool because if used well and in conjunction with the other NPDS Setup values you can change the whole look of your NPDS Server by changing the settings in NPDS Setup.. no re-writing of the pages required!
For a fine example of using these tags together, check out this page, which is the default page that is served by NoteServ that shows all the tags BEFORE the substitution mechanism replaces them.
Writing You Own Custom Server Side Includes:
Version 2.0 of NPDS contains Simple Scripting Architecture which allows you to write Newtonscripts that return up to 1000 bytes of text and can be inlined into any NPDS Content by assigning then their own Server Side Includes. For more details and some examples, see the manual section on the "Simple Scripting Architecture".
When a client accesses the /html/ directory, NoteServ serves a default file called "index.html". You can easily over-ride the "index.html" that NoteServ delivers like so:
* You can actually get around this if you're a REAL Newton Guru. After you've written a great index.html page, open up the preferences entry named "pHTML:MAVON" and paste the text of your custom index.html into the slot called "sys_index". This text will over-ride the built in page and any note titled "index.html" until it is removed.