[Zope] How do I change the document title via DTML?

Farrell, Troy troy.farrell@wcg.com
Mon, 10 Sep 2001 10:46:21 -0500


Well, it depends on the DTML you are using to show the title of the
document.

My standard_html_header is:

<?xml version="1.0" ?>
<dtml-comment>
MS should get it's act in gear so I can do this...
<?xml-stylesheet type="text/css" href="&dtml.url-global_css;"?>
</dtml-comment>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <title><dtml-var name="title_or_id"></title>
<--------------- Here
    <link rel="StyleSheet" type="text/css" href="&dtml.url-global_css;" />
  </head>
  <body>
  <dtml-var name="navbar" missing>

You can see the title is called in the line <dtml-var name="title_or_id">.
To change this dynamically, I did this in my index_html:
<dtml-var expr="standard_html_header(_.None, _, title_or_id='A new title')">
instead of the normal
<dtml-var name="standard_html_header">
All I've done is replace title_or_id in the namespace that is passed to
standard_html_header :)

Troy


> -----Original Message-----
> From: HoYin Au [mailto:hya-zope@bluesite.com]
> Sent: Monday, September 10, 2001 10:30 AM
> To: zope@zope.org
> Subject: [Zope] How do I change the document title via DTML?
> 
> 
> I have a DTMLDoc that calls a SQL Method to display the 
> profile for a user.  I want to be able to dynamically change 
> the document's title (before calling standard_html_header and 
> the document itself, both of which contains calls to 
> title_or_id) so that the title shows "Profile for user 
> <<username from profile>>".  I've tried using dtml-let, 
> REQUEST.set (using dtml-call), as well as <dtml-var 
> standard_html_header title='blah blahb lah'>... all of which 
> didn't work.  Any advice?