






Hotspots: Admin Pages | Turn-in Site |
Current Links: Case Final Project Summer 2007
M9 - Design Twist (application online)
Contents:
Embedding SmallTalk Code
To embed SmallTalk code into an html file, you simply use the <% and %> tags to surround your code. You must save the new file with the .ssp extension in order for the server to recognize that the file contains SmallTalk code.
Example:
<%
temp := CCS new.
temp addSupplier: supplier1
%>
Query Strings
When you create forms, you specify the action and the method for processing the submitted form. Using the GET method will place the form values into the url.
Example:
www.mywebsite.com/processForm.ssp?name=JohnSmith
Using the POST method will not place these values into the url. Both of these methods allow you to obtain the form values on the page that handles the form action. To retrieve form values, you use the request object and the anyParameterValueAt: message.
Example:Retrieving the value of the username component.
username := request anyParameterValueAt: 'username'.
Session Variables
Session variables are useful for maintaining data across multiple pages, especially when you are not passing values via query strings. To use session variables, you simple make a call to store a value in a session variable using the put: message. To retrieve, you just make a call on the session object and specify the name of the session variable you want.
Example: Setting a session variable
session at:'sessionVar' put:anObject
Example: Retrieving a session variable
myVar := session at:'sessionVar'
Stylesheets
Cascading StyleSheets (CSS) are used for formatting of web pages. CSS files have the .css file extension. The basic structure of a style rule is:
tag {
property: value;
property: value;
}
Example: To set the font for the H1 tag
h1
{
font-family: "Courier New, Courier, serif";
}
Include Files
Include files are handy for code reuse. For example, if a website uses code for a navigation bar at the top of every page, and also a footer at the bottom of every page, you can put the code for each of these into include files, and then specify them as included files in each page. That way, if you need to change a link in the navigation bar or footer, you simply have to update a single file, rather than every page in your website. Include files are just text files that contain your markup/code. Usually, it's easier to just specify them with the .inc file extension.
To specify an include file, use the following syntax in a .ssp page:
<!-- #include file="filename.inc" -->
Link to this Page