Zope Notes - Web Team Procedures and Notes
These are 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
- <dtml-if> Notes
- <dtml-if expr> Notes
- Get URL and Filename: URL#, BASE#, etc.
- Current Date
- Document Date (last modified)
Properties Used for Ohlone College Website
| Name (alphabetical order) | Type | Valid Value | Property of which Zope object | Description |
|---|---|---|---|---|
| breadcrumb | string |
|
Folder (but could also be DTML Document) | See comments in z_breadcrumbs.inc. |
| meta_description | string | [unique] | DTML Document (preferred) or Folder |
|
| meta_keywords | ||||
| page_meta | string | <meta name="NAME" content="CONTENT" /> | DTML Document |
|
| page_type | string | default | / | 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 home page | |
| string | core | /core | /core directory | |
| string | newarkhome | /org/newark/home.html | Newark Center home page | |
| title | string | [unique] | DTML Document, Folder, etc. | Required property; can be blank (default). |
<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 "or" Operator
<dtml-if expr="page_type == 'home' or page_type == 'core'">
…
</dtml-if>
Using "and" Operator
<dtml-if expr="page_type != 'home' and page_type != 'core'">
…
</dtml-if>
Get URL and Filename
URLhas value of the URL, including filename and without query stringURL0has value of the URL, including filename and query string
URL#"counts" backward from the end of the URLBASE#"counts" foward from the beginning of the URL
URLPATH#excludes the domain nameBASEPATH#- 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
BASE3before using it:
<dtml-if BASE3>
<dtml-var BASE3>
</dtml-if>
- So, it's best to test for
- 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 home page, but Zope uses "index_html" as the filename
- The value of the
.endswith('string')function includes a beginning slash
<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>
Examples for this specific web page (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" and additional string methods: http://www.tutorialspoint.com/python/string_endswith.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>
