Index: openacs-4/packages/acs-content-repository/www/doc/guide/publish.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/www/doc/guide/publish.html,v diff -u -N -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/www/doc/guide/publish.html 12 Apr 2013 16:12:56 -0000 1.4 +++ openacs-4/packages/acs-content-repository/www/doc/guide/publish.html 7 Aug 2017 23:47:47 -0000 1.5 @@ -6,7 +6,7 @@

Publishing Content

- Content Repository : Developer Guide + Content Repository : Developer Guide

The content repository does not place any restrictions on the @@ -20,7 +20,7 @@ following diagram illustrates the steps typically involved in such a publication process:

- +

In general, there is an initial resolution step in which the server must identify the appropriate content item and then decide @@ -31,12 +31,12 @@

Matching URLs to Content Items

The primary mechanism for matching URLs to Content Items are - virtual URL handlers, .vuh files. An + virtual URL handlers, .vuh files. An explanation of virtual URL handlers can be found in the tutorial on the Request Processor.

-

Here is an example index.vuh file that you can adapt to +

Here is an example index.vuh file that you can adapt to your own purposes:

@@ -47,9 +47,9 @@
 
 # Get the IDs
 set content_root \
-  [db_string content_root "select content_item.get_root_folder from dual"]
+  [db_string content_root {select content_item.get_root_folder from dual}]
 set template_root \
-  [db_string template_root "select content_template.get_root_folder from dual"]
+  [db_string template_root {select content_template.get_root_folder from dual}]
 
 # Serve the page
 # DRB: Note that content::init modifies the local variable the_root, which is treated
@@ -62,34 +62,34 @@
   ns_returnnotfound
 }
 
-

The content_root and template_root parameters +

The content_root and template_root parameters select the content and template root folders. In the example, they are just the default roots that the content repository initializes on installation. If you want to store your content completely independent from that of other packages, you can initialize your own - content root and pass that folder's ID on to content::init. + content root and pass that folder's ID on to content::init.

To publish content through URLs that are underneath - /mycontent you need to do the following: + /mycontent you need to do the following:

    -
  1. Create a directory mycontent in your server's page root - and an index.vuh file in that directory. +
  2. Create a directory mycontent in your server's page root + and an index.vuh file in that directory.
  3. -
  4. Adapt the set content_root ... and set - template_root .. statements in the example above so that +
  5. Adapt the set content_root ... and set + template_root .. statements in the example above so that they are being set to the content and template root folders that you want to publish content from.
  6. -
  7. Change the set the_url ... statement so that the - variable the_url contains the absolute path to the content +
  8. Change the set the_url ... statement so that the + variable the_url contains the absolute path to the content item you wish to serve from your (or the default) content root.
-

If you use the example index.vuh file above unaltered for - requests to my_content, a request for - http://yourserver/mycontent/news/articles/42 would request - the content item /news/articles/42 from the content +

If you use the example index.vuh file above unaltered for + requests to my_content, a request for + http://yourserver/mycontent/news/articles/42 would request + the content item /news/articles/42 from the content repository on the default content root folder.

@@ -104,17 +104,17 @@ attribute tables for the entire chain of inheritance for that content type. The view always has the same name as the attribute table for the content table, with an "x" appended to distinguish it from the -table itself (for example, if the attribute table for Press -Releases is press_releases, then the view will be named -press_releasesx. Querying this view is a convenient means of +table itself (for example, if the attribute table for Press +Releases is press_releases, then the view will be named +press_releasesx. Querying this view is a convenient means of accessing any attribute associated with a content item.

-As a shortcut, the item's template may call content::get_content +As a shortcut, the item's template may call content::get_content in its Tcl file in order to automatically retrieve the current item's attributes. The attributes will be placed in a onerow datasource called -content . The template may then call -template::util::array_to_vars content in order to convert +content . The template may then call +template::util::array_to_vars content in order to convert the onerow datasource to local variables.