Index: openacs-4/packages/acs-core-docs/www/tutorial-vuh.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-vuh.html,v diff -u -N -r1.10 -r1.10.2.1 --- openacs-4/packages/acs-core-docs/www/tutorial-vuh.html 16 Feb 2005 00:21:03 -0000 1.10 +++ openacs-4/packages/acs-core-docs/www/tutorial-vuh.html 26 Aug 2005 00:02:30 -0000 1.10.2.1 @@ -1,5 +1,5 @@ -Using .vuh files for pretty urls

Using .vuh files for pretty urls

.Vuh files are special cases of .tcl files, used for rewriting incoming urls. We can use a vuh file to prettify the uri for our notes. Instead of note-edit?item_id=495, we can use note/495. To do this, we will need a new .vuh file for redirection and we will need to change the referring links in note-list. First, add the vuh:

[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www
-[$OPENACS_SERVICE_NAME www]$ emacs note.vuh
+Using .vuh files for pretty urls

Using .vuh files for pretty urls

.Vuh files are special cases of .tcl files, used for rewriting incoming urls. We can use a vuh file to prettify the uri for our notes. Instead of note-edit?item_id=495, we can use note/495. To do this, we will need a new .vuh file for redirection and we will need to change the referring links in note-list. First, add the vuh:

[$OPENACS_SERVICE_NAME $OPENACS_SERVICE_NAME]$ cd /var/lib/aolserver/$OPENACS_SERVICE_NAME/packages/myfirstpackage/www
+[$OPENACS_SERVICE_NAME www]$ emacs note.vuh
 

Paste this into the file:

# Transform requests of type: a/b
 # into this internal request: A?c=b
 # for example, note/495 > note-edit?item_id=496
@@ -17,7 +17,7 @@
 set internal_path "/packages/[ad_conn package_key]/www/note-edit"
 
 rp_internal_redirect $internal_path
-

We parse the incoming request and treat everything after the final / as the item id. Note that this simple redirection will lose any additional query parameters passed in. Many OpenACS objects maintain a pretty-name, which is a unique, human-readable string, usually derived from title, which makes an even better 'pretty url' than a numeric id; this requires that your display page be able to look up an item based on pretty id.

We use rp_form_put to store the item id in the internal register that the next page is expecting, and then redirects the request in process internally (ie, without a browser refresh).

Next, modify note-list so that its link is of the new form.:

[$OPENACS_SERVICE_NAME www]$ emacs ../lib/note-edit.tcl
+

We parse the incoming request and treat everything after the final / as the item id. Note that this simple redirection will lose any additional query parameters passed in. Many OpenACS objects maintain a pretty-name, which is a unique, human-readable string, usually derived from title, which makes an even better 'pretty url' than a numeric id; this requires that your display page be able to look up an item based on pretty id.

We use rp_form_put to store the item id in the internal register that the next page is expecting, and then redirects the request in process internally (ie, without a browser refresh).

Next, modify note-list so that its link is of the new form.:

[$OPENACS_SERVICE_NAME www]$ emacs ../lib/note-edit.tcl
 db_multirow \
     -extend {
 	edit_url
@@ -29,7 +29,7 @@
                mfp_notesx n
         where  n.revision_id = ci.live_revision
     } {
-	set edit_url [export_vars -base "note/$item_id"]
+	set edit_url [export_vars -base "note/$item_id"]
 	set delete_url [export_vars -base "note-delete" {item_id}]
     }
 

You may also need to change some of the links in your