bar-button — display content (usually a menu bar) based on page name
Attribute | Pos. | Req. | Default | Description |
---|---|---|---|---|
page | Yes | Yes | Name of the page for which the button is defined. | |
current | Yes | Current page name (as obtained from
MV_PAGE ). |
Name of the current page. Usually you do not want to override the default. | |
interpolate | 0 | interpolate input? | ||
reparse | 1 | interpolate output? | ||
hide | 0 | Hide the tag return value? |
This tag can display content depending on current (or provided) page name. It is most directly useful for creating menu bars (although other uses are not excluded).
The content between the [selected]
[/selected]
tags will be
displayed if the name of the current
page (MV_PAGE
variable, or your custom
current argument)
matches the page parameter.
The default content (one outside of [select]
tags) will be displayed
when there is no match.
Example: Create 3-button menubar
Create three different pages,
page1.html
,
page2.html
and
page3.html
, each with the identical content:
<table><tr> [bar-button page=page1] <td><a href="[area page1]">PAGE-1</a></td> [selected] <td bgcolor="red"><a href="[area page1]"><b>PAGE-1-selected</b></a></td> [/selected] [/bar-button] [bar-button page=page2] <td><a href="[area page2]">PAGE-2</a></td> [selected] <td bgcolor="red"><a href="[area page2]"><b>PAGE-2-selected</b></a></td> [/selected] [/bar-button] [bar-button page=page3] <td><a href="[area page3]">PAGE-3</a></td> [selected] <td bgcolor="red"><a href="[area page3]"><b>PAGE-3-selected</b></a></td> [/selected] [/bar-button] </tr></table>
Interchange 5.9.0:
Source: code/UserTag/bar_button.tag
Lines: 25
# Copyright 2003-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: bar_button.tag,v 1.5 2007-03-30 23:40:56 pajamian Exp $ UserTag bar-button Order page current UserTag bar-button PosNumber 2 UserTag bar-button HasEndTag 1 UserTag bar-button Version $Revision: 1.5 $ UserTag bar-button Routine <<EOR sub { use strict; my ($page, $current, $html) = @_; $current = $Global::Variable->{MV_PAGE} if ! $current; $html =~ s!\[selected\]((?s:.)*)\[/selected]!!i; my $alt = $1; return $html if $page ne $current; return $alt; } EOR