On Thu, 18 May 2000, Luis Cortes wrote:
> Hello,
>       Can someone provide me with a sample of how they are doing the Header
> and Side Bars on their websites?  It seems to me that it could be done with a
> STANDARD_HTML_HEADER approach, but I am at a loss. I don't know how to include
> the main text to each STANDARD_HTML_HEADER so that the text is side by side
> with the side bar.

I've been refining just such a thing since i started my very first ZOPE site. 
This is probably still no where near as good as it could be, but it certainly
works fine for me.

This particular snipped is directly from a working site, and includes a user
login on the sidebar.  If called with a variable of 'no_side' in existance, the
sidebar is omitted.  Across the top of the page is a list of site sections
(pages in top folder with an attributed of 'DoSub'), and a list of pages in the
current section (pages in current folder with an attribute of 'DoIndex'). 
DoSub contains the permissions required to have access to that section.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Traditional//EN"
<dtml-call FSSession>
<html><head><title><dtml-var title></title></head>
<table border="0" cellspacing="0" cellpadding="2" width="640">
  <tr><td width=100 bgcolor="crimson"><h1><dtml-var title_or_id></h1></td>
      <td width=540 bgcolor="crimson">
        <table width="500">
          <tr align="left">
              <td rowspan="2"><img src="images/logo" width="82" height="60"></td>
              <th><a href="<dtml-var "PARENTS[_.len(PARENTS)-2].id">"><dtml-var 
              <dtml-in "PARENTS[_.len(PARENTS)-2].objectValues('Folder')">
                <dtml-if "getAttribute('DoSub')">
                  <dtml-if "authorityCheck(_.None, _, perms=DoSub)">
                    <th><a href="<dtml-var id>"><dtml-var title></a></th>
          <tr align="left">
              <th><dtml-var "PARENTS[0].title">:</th>
              <dtml-in "PARENTS[0].objectValues('DTML Document')">
                <dtml-if "getAttribute('DoIndex')">
                  <td><a href="<dtml-var id>"><dtml-var title></a></td>
<dtml-if no_side>
  <tr><td width=640 bgcolor="#f8f8f8" valign="top" colspan="2">
  <tr><td  width=100 bgcolor="crimson" valign="top">
        <dtml-if "FSSession.has_key('UserName')">
          <form action="<dtml-var "PARENTS[_.len(PARENTS)-2].id">/logout_html">
            <b>User&nbsp;Name:</b> <dtml-var "FSSession['UserName']"><p>
            <b>Company:</b> <dtml-var 
            <input type="submit" value="Logout">
          <form action="verify_html">
            <h3>User Name:</h3> <input type="text" name="username" size="8"><br>
            <h3>CompanyID:</h3> <input type="text" name="company" size="8"><br>
            <h3>Password:</h3> <input type="password" name="passwd" size="8"><P>
            <input type="submit" value="Login">
        <hr size="1" width="80%">
        <dtml-var side_bar>
        <hr size="1" width="80%">
        <dtml-if sub_bar>
          <dtml-var "_[sub_bar]">
      <td width=540 bgcolor="#f8f8f8" valign="top">


I realise this is likely not the clearest code possible.  Also, I could
probably use internal zope permissions instead of stuff in the DB, but for this
case, the DB was the simplest solution (for me :).

There is, of course, a matching standard_html_footer to go with this, which has
ends the td  with </td>, and the row </tr>... and then adds a final row for a
'footer', then closes the table, and the page.

NOTE:  This code assumes the site is one folder off the root
(www.mysite.com/folder/*).  the PARENTS[_.len(PARENTS)-2].id expressions would
need to be adjusted if this is not so.

Hope this is of some help, and I really would appreciate anyones comments for

> Thanks ahead of time for your help,
> Luis.
Have a better one,

<dtml-var standard_work_disclaimer>

Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to