Zope Notes - Web Team Procedures and Notes

This page is intended for use only by the Web Team.

Summary of Zope-related information used on the Ohlone College website.

Properties Used for Ohlone College Website

Zope DTML-LET Variables Set in HTML Files
(updated November 15, 2010)
Variable Name (alphabetical order) Type Values How used Notes
page_link_icon string   Available but not used yet. Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>). FINE TUNE THIS INFO WHEN USED. See x_global_meta.inc
page_meta_contentlanguage string   Available but not used yet. Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>). FINE TUNE THIS INFO WHEN USED. See x_global_meta.inc
page_meta_expires string   Available but not used yet. Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>). FINE TUNE THIS INFO WHEN USED. See x_global_meta.inc
page_meta_refresh string Format: <dtml-let page_meta_refresh="'0;URL=PATHFILENAMEl'"> Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>) See any /go/ shortcut file for example
page_meta_robots string noindex,nofollow [or other valid meta robots values] Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>) See x_global_meta.inc
page_title string Appropriate for individual HTML file Set using dtml-let inside HTML file (wrap around <dtml-var z_local_headerXXXXXX.inc>) Used in all full web page HTML files
plugintype string wmv, real, pdf-wmv [see z_plugin_notice.inc.html for complete list] Set using dtml-let include (.inc) file which is inserted where desired in HTML file Example: The plugin notice for PDF files is included for each HTML page linking to a PDF file.
Zope Properties Assigned to Folders and/or Files in Zope
(updated November 15, 2010)
Name (alphabetical order) Type Valid Value Property of which Zope object Description

breadcrumb

20101115 NOTE: This variable is setup to be tested in z_breadcrumbs.inc but is not at this time being used on any folder or file.

string
  • no
  • noother
Folder (but could also be DTML Document) See comments in z_breadcrumbs.inc.
meta_description string [unique] DTML Document (preferred) or Folder
  • Should be unique for each individual web page (discontinued as a regular practice about 2004 (very time consuming to maintain), but lots of pages still have this property).
  • Can also be property of a Folder then the property values flows down to each page in that folder.
meta_keywords
page_meta - 20101115 NO LONGER USED AS ZOPE PROPERTY string <meta name="NAME" content="CONTENT" /> DTML Document
  • Used to designate a <meta> tag just for that web page, such as: <meta name="robots" content="index,nofollow" />.

page_type

20101115 NOTE: More difficult to move into HTML files as dtml-let because used in header and footer!

string default /
[i.e., root directory]

Ohlone College website root directory.

Used a lot with <dtml-if expr> (see dtml-if).

If the page_type property does not exist, Zope will display a KeyError exception when it tries to find the variable. Therefore, it is necessary to assign page_type on the root folder. The page_type property on the root folder is read only when an object (DTML Document, Folder) doesn't have its own page_type property assigned - this is Zope's acquisition feature.

string home /home.html Ohlone College homepage
string core /core/ /core directory
string newarkhome /org/newark/home.html Newark Center homepage
string portal
  • /org/newark/core/studentservices.html
  • /org/newark/core/facultystaffinfo.html
"portal" page like those in /core directory
title
USING page_title variable set with dtml-let in each HTML file (see above table)
string [unique] DTML Document, Folder, etc. Required property; can be blank (default).

How to Find Zope Properties Assigned to Folders and/or Files

  • Login to Zope
  • Navigate to directory where search will start
  • Select "Find" in the top menu
  • Select "Advanced" link
  • Enter this in the "expr" textbox: PROPERTYNAME != ''
    • where PROPERTYNAME is the name of the property to search for (example: page_meta)
    • NOTE: '' is 2 single quotes with no space in between
  • Select the "Find" button

<dtml-if> Notes

Test whether a DTML Method exists.

<dtml-if z_local_bottomnav.inc>
  …
<dtml-elif z_global_bottomnav.inc>
  …
<dtml-else>
  …
</dtml-if>

<dtml-if expr>

Test the page_type property.

<dtml-if expr="page_type == 'home'">
  …
</dtml-if>

Using "and" Operator

<dtml-if expr="page_type != 'home' and
               page_type != 'core'
              ">
  …
</dtml-if>

Using "or" Operator

<dtml-if expr="page_type == 'home' or
               page_type == 'core'
              ">
  …
</dtml-if>

Get URL and Filename

  • URL has value of the URL, including filename and without query string
  • URL0 has value of the URL, including filename and query string

  • URL# "counts" backward from the end of the URL
  • BASE# "counts" foward from the beginning of the URL

  • URLPATH# excludes the domain name
  • BASEPATH# - does not seem to work like I thought it would

  • If, for example, there is no BASE3 (or 1 or 2 or 4 or 5 or…), there will be a very unfriendly error in the browser
    • So, it's best to test for BASE3 before using it:
      <dtml-if BASE3>
        <dtml-var BASE3>
      </dtml-if>
  • If the value is a directory, the ending slash is not included
  • On the Ohlone website, "home.html" is the filename of a directory's homepage, but Zope uses "index_html" as the filename
  • The value of the .endswith('string') function includes a beginning slash

Check true:

<dtml-if expr="URL0.endswith('/index_html')">
  <dtml-var URL0>
<dtml-elif expr="page_type != 'home'">
  <dtml-if URL2>
    <dtml-var URL2>
  </dtml-if>
<dtml-else>
  <dtml-if URL1>
    <dtml-var URL1>
  </dtml-if>
  [whatever]
</dtml-if>

Check false (== 0) / not true (!= 1):

<ul>
<dtml-if expr="URL0.endswith('/scholarshiprecipients-citizenofyear.html') == 0">
  <li><a href="/org/foundation/scholarships/2011spring/scholarshiprecipients-citizenofyear.html">Citizen of the Year Scholarships Recipients</a></li>
</dtml-if>
<dtml-if expr="URL0.endswith('/scholarshiprecipients-otherfoundation.html') != 1">
  <li><a href="/org/foundation/scholarships/2011spring/scholarshiprecipients-otherfoundation.html">Other Foundation Scholarships Recipients</a></li>
</dtml-if>
</ul>

<dtml-if expr="URL0.startswith('http://dev.ohlone.edu')">
  <!--Do something on dev.ohlone.edu but not www.ohlone.edu-->
</dtml-if>

Examples for this specific web page's URL, which is
http://www.ohlone.edu/org/webteam/proceduresnotes/zopenotes.html :

<dtml-var URL0> http://www.ohlone.edu/org/webteam/proceduresnotes/zopenotes.html
<dtml-var URL1> http://www.ohlone.edu/org/webteam/proceduresnotes
<dtml-var URL2> http://www.ohlone.edu/org/webteam
<dtml-var URL3> http://www.ohlone.edu/org

<dtml-var URLPATH0> /org/webteam/proceduresnotes/zopenotes.html
<dtml-var URLPATH1> /org/webteam/proceduresnotes
<dtml-var URLPATH2> /org/webteam
<dtml-var URLPATH3> /org

<dtml-var BASE0> http://www.ohlone.edu
<dtml-var BASE1> http://www.ohlone.edu
<dtml-var BASE2> http://www.ohlone.edu/org
<dtml-var BASE3> http://www.ohlone.edu/org/webteam

<dtml-var BASEPATH0>
<dtml-var BASEPATH1>
<dtml-var BASEPATH2> /org
<dtml-var BASEPATH3> /org/webteam
<dtml-var BASEPATH4> /org/webteam/proceduresnotes

<dtml-if BASEPATH3>
  <dtml-if expr="BASEPATH3 == '/org/webteam'">
    Yes
  <dtml-else>
    No
  </dtml-if>
</dtml-if>

RESULT of above code: Yes

More information, as well as BASEn, URLPATHn, BASEPATHn: Zope Bible, p. 421, © 2002. Information about "str.endswidth()", "str.startswith()", and additional string methods: http://www.tutorialspoint.com/python/string_endswith.htm, http://www.tutorialspoint.com/python/string_startswith.htm, and Python built-in types: http://docs.python.org/library/stdtypes.html.

Current Date

<dtml-var ZopeTime fmt="%A, %B %d, %Y">

Document Date (last modified)

<dtml-with bobobase_modification_time>
  <dtml-var "'Last modified %s, %s %i, %i.' % (DayOfWeek(), Month(), day(), year())">
</dtml-with>