AddLeftMenu < Codev < TWiki

I looked at BetterSkins, and decided that I wanted a menu on the left hand side like lots of web sites. It turned out to be easy, except for one small detail.

I edited view.tmpl to put the left menu and the %TEXT% into a table. The menu is handled by Warning: Can't find topic Codev.WebLeftMenu . I decided to put the statement into the WebLeftMenu topic to give the most control to the administrator setting up the menu.

Note: in the following examples I put a space after the opening % in a TWikiVariable so that it would be displayed. Remove it if you cut and paste.

The %TEXT% in view.tmpl was replace with:

<table width="100%" border="0" cellpadding="3" cellspacing="0">
 <tr>
% INCLUDE{"WebLeftMenu"}%
 <td>
% TEXT%
 </td>
</table>

An example WebLeftMenu file contains something like:

Edit the following to change the menu on the left side of this web.
It will be included in a formatting table in the view template.
<table>
% STARTINCLUDE%
<td bgcolor="% WEBBGCOLOR%" cellpadding="0" align="left" valign="top">
<font size=-1> 
<b>
<I>Internal</i><br>
<A HREF="http://www.databeacon.com" TARGET="_blank">Company web</A><br>
<I>External</I><br> 
 [[http://java.sun.com][Java]]<br>
 [[https://twiki.org][Twiki]] <br>
 [[http://java.sun.com/j2ee][J2EE]] <br>
 [[http://www.junit.org][JUnit]] <br> 
<b>
</font>
</td>
% STOPINCLUDE%
</table>

The problem is that the forced links in the menu don't seem to be converted into html links. Am I doing something wrong? Even plain URLs don't get converted. It does seem to be something I'm doing, since I edited the TWikiWebsTable and inserted links, and they showed up fine in Main. I'm sure there's some little detail I'm missing.

-- JeffSparkes - 20 Jun 2001

The problem you experience is because the view, preview and rdiff scripts only expand the variables on the template but do not Wiki-render it. To fix that you can add this at the end of those scripts:

 $tmpl = &TWiki::handleCommonTags( $tmpl, $topic, $webName );
 my( $head, $body ) = split( /<body/i, $tmpl, 2 );
 $tmpl = join( "", $head, &TWiki::getRenderedVersion( "<body$body" ) );
 $tmpl =~ s/%TEXT%/$text/go;

-- PeterThoeny - 23 Jun 2001

TWikiAlphaRelease has been updated, all scripts are calling getRenderedVersion() for the templates.

-- PeterThoeny - 26 Jun 2001

I think this is likely to throw up some problems with different enhancements that people have done to templates.

-- JohnTalintyre - 26 Jun 2001

It might have some side-effects with existing templates and skins. Those need to be upgraded anyway because there are other changes like MetaDataRendering.

Things to check:

  • Remove empty lines unless you want a =<p>.
  • Escape TWikiWikiWords you don't want to be linked.

See also TWikiReleaseSpring2001UpgradeNotes

-- PeterThoeny - 26 Jun 2001

Edit | Attach | (削除) Watch (削除ここまで) | Print version | History : r11 < r10 < r9 < r8 < r7 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r11 - 2020年04月26日 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

AltStyle によって変換されたページ (->オリジナル) /