You are not logged in Log in Join
You are here: Home » Members » Ioan's Zope Documents » Site Navigation Table » dc_view

Log in
Name

Password

 
 


Dublin Core Elements

The Dublin Core metadata element set is a standard for cross-domain information resource description.
Element Description Value
Identifier resource ID http://old.zope.org/Members/Ioan/NavTable
Title resource name Site Navigation Table
Description resource summary <h1>Site Navigation Table</h1> Two <b>Python</b> scripts (which means two table styles), some pictures and a css file.<br> That is what this product contain.<br> (This is more a <i>how-to</i> than a <i>product</i>.)<br> <br> But you better look at these pictures:<br> <table> <tr> <th>Demo</th><th>Style 1</th><th>Style 2</th> </tr> <tr> <td valign="top"><img src="demo.jpg" border=0</td> <td valign="top"><img src="nav1.jpg" border=0</td> <td valign="top"><img src="nav2.jpg" border=0</td> </tr> </table> <h1>To make this scripts to work you must:</h1> <ul> <li>Add property of root folder <b>iconspath</b> to keep the path to your icons.<br> I use <a href="http://www.zope.org/Members/jfarr/Products/LocalFS/" target="_blank">LocalFS</a> to point to a folder with gifs. <li>Add a property of root folder <b>bk_color</b> which keep <i>#5566aa</i> or <i>#99bbff</i> if you want; the background color. <li>Add a lot of <b>folders</b> with title <li>Add a lot of <b>DTML Documents</b> with title <li>Add a lot of <b>WikiPages</b> (no title - you don't need title) <li>And add a lot of what ever you want, but set a title <li>The <b>Python</b> script will<br> <b>for i in self.objectItems(items):</b><br> and you call the script like that:<br> <b>&lt;dtml-var "navtable1(PARENTS[-1],'Home','/home.htm',['ZWiki Page','DTML Document'])"&gt;</b><br> or <b>&lt;dtml-var "navtable1(PARENTS[-1],'Home','/home.htm',['Folder'])"&gt;</b><br> <li><b>PARENTS[-1]</b> is the <u><b>root</b></u> of your site<br><b>PARENTS[0]</b> is the current folder.<br> use <b>PARENTS[0]</b> when you want to display a site map (nav table) from current folder.<br> <li>You need a title to your documents.<br> If that document don't have title - that means is not for public (not yet) so will not be listed on nav table (WikiPages are special, you know)<br> <li>Each document with title should have a property called <b>ico</b> which keep the icon image filename.<br> When the script build the nav table, it will append at <b>iconspath</b> the value from <b>ico</b> and will display a picture.<br> <b>iconspath</b>=/z/icons/<br> <b>ico</b>=book.gif<br> If you don't set an <b>ico</b>n the script will use <b>'Leaf.gif'</b> instead. Be sure you have this file. </ul> <br> <h1>The Python script</h1> <pre> <b>Title</b> : Navigation Table version 2 <b>Parameter List</b> :self,t='Home',a='',items=['Folder','ZWiki Page','DTML Document'],f=1 <b>The body:</b> # #t =title of table #a =link adress title #items=list with zope items #f =1 for table with width=100% # # set colors c_border='#000000' c_title='#333399' c_body='#4444aa' ret='' ret=ret+'&lt;table' if f==1: ret=ret+' width="100%"' ret=ret+' border="0" cellspacing="0" cellpadding="1" bgcolor="'+c_border+'+"&gt;&lt;tr&gt;&lt;td&gt;' ret=ret+'&lt;table width="100%" border="0" cellspacing="1" cellpadding="3"&gt;' ret=ret+'&lt;tr&gt;&lt;td align=left bgcolor="'+c_title+'"&gt; &lt;img src="/img/nav/bar.jpg" border=0&gt; &lt;a href="'+a+'" class="tmap2"&gt;'+t+'&lt;/a&gt; &lt;img src="/img/nav/bar.jpg" border=0&gt;&lt;/td&gt;&lt;/tr&gt;' ret=ret+'&lt;tr&gt;&lt;td bgcolor="'+c_body+'"&gt;' for i in self.objectItems(items): o=i[1] #the object title=o.title id=i[0] if (title != '' and id != 'index_html') or o.getNodeName()=='ZWikiPage' : #ret=ret+'&lt;img src="' #ret=ret+'/img/nav/arr_left.gif' ret=ret+'&lt;img src="'+self.iconspath if o.hasProperty('ico'): ret=ret+o.ico else: ret=ret+'Leaf.gif' ret=ret+'"&gt; &lt;a href="'+o.absolute_url()+'"' if o.hasProperty('tar'): ret=ret+'target="'+o.tar+'"' ret=ret+' class="map2" &gt;'+title+'&lt;/a&gt;&lt;br&gt;' ret=ret+'&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br&gt;' return ret </pre> <h1>Parameters</h1> <pre># #t =title of table #a =link adress title #items=list with zope items #f =1 for table with width=100% # <b>Sample: </b> &lt;h1&gt;Nav table 1&lt;/h1&gt; &lt;dtml-var "navtable1(PARENTS[-1],'Home','/home.htm',['ZWiki Page','DTML Document'],0)"&gt; &lt;h1&gt;Nav table 2&lt;/h1&gt; &lt;dtml-var "navtable2(PARENTS[-1],'Home','/home.htm',['ZWiki Page','DTML Document'],0)"&gt; </pre> <h1>Sort items</h1> You may sort items into your generated table with:<br> <pre> <b>lista=self.objectItems(items) lista.sort() for i in lista:</b> instead of using this : <b>for i in self.objectItems(items):</b> </pre> <br><br> <b>That's all! Tell me if you have questions.</b>
Creator resource creator Ioan
Date default date 2001-07-09 06:56:48
Format resource format text/html
Type resource type Software Package
Subject resource keywords Content Object, Developer, Examples, Helpers, Navigational, Visual
Contributors resource collaborators
Language resource language
Publisher resource publisher No publisher
Rights resource copyright


Additional Zope Elements

Element Description Value
CreationDate date resource created 2001-07-09 06:56:48
ModificationDate date resource last modified 2001-07-09 06:56:48
EffectiveDate date resource becomes effective None
ExpirationDate date resource expires None

Backlinks: via Google / Technorati