BASICS

ADMINISTRATION

DEVELOPMENT

SUPER ADMIN

  LAST UPDATED
5/24/2013

Passing Directory Variables

Directory variables can be an important tool for a site developer or administrator. The concept is simple. Each directory variable has a property name, and a corresponding property value represented as a snippet of text. These variables have context. For instance, applying a directory variable to the “/academics” folder will set that value for that directory and all of the directories below it. Therefore, “/academics/biology” will have this value defined, but a sibling directory such as the “/athletics” directory will not. However, this value is not permanently set as the value can be overridden further down in the directory structure by simply recasting a variable with the same name and different value.

Example Directory Variables

Directory Variables

 

Using Directory Variables

The directory variable system was designed to serve multiple purposes. Currently, it has three pre-populated variable options, which can be used during the new page creation process and as a part of the XSL.

The following are system-level directory variables:

1.  ox_ftp_image_root: Redefines the default image directory in the WYSIWYG Editor for this directory and all children directories. The value is the path from the site root to the target image directory.
For example: /admissions/images or  /athletics/baseball/images

2.  ox_ftp_media_root: Redefines the default media directory in the WYSIWYG Editor for this directory and all children directories. The value is the path from the site root to the target image directory.
For example: /admissions/media or  /athletics/baseball/media

3.  publish: Defines publishing actions. It is used with a value of skip:[extensions list]. Extensions are separate with a comma and no spaces.

When the ox_ftp_image_root or ox_ftp_media_root are set for a given directory, a user will be placed into that set location when they use the Insert/Edit Image or Insert/Edit Embedded Media tools of the WYSIWYG Editor.

Directory variables can be used in:

1.  In the XSL

2.  In the echo var of the TMPL

3.  In the <directory-list>’s child nodes

4.  In the <template-list>’s child nodes

5.  In the <navigation-list>’s child nodes

Passing a Directory Variable to the TMPL

Using directory variables in the XSL allows the value to remain variable after page creation. Using a directory variable in the TMPL passes the current value at the time of page creation. Therefore, if the directory variable is updated later, the current pages will not be affected.

There are still valuable use cases for this. One such use case is to define a path for a filechooser that is part of the page properties. This can allow the default location to be based on the directory in which the page was created.

  1. Navigate to /_resources/ou/templates.
  2. Copy article.tmpl to the same directory, and rename it to pt-article.tmpl.
  3. Open and edit pt-article.tmpl.
  4. In the parameter named “article_image,” replace the current path (/_resources/images/news) with <!--%echo var="news-image" -->.
  5. Test by creating a new page, and then editing the page properties. Make sure to use the Page Templating New News TCF.

Was this page helpful?

Additional Comments:


(Include your email address if you would like a reply)