Source code of tbs_us_examples_cond.htm

  1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>TinyButStrong - Example of conditional blocks</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./tbs_us_examples_styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
<!--
// fixed by Andrea (2012)
function f_Select() {
    var url = window.location.href;
    var id = document.forms['frm_condition'].elements['lst_block'].value;
    if (url.indexOf('?')==-1) {
        sPrm = '?blk_id=';
    } else {
        sPrm = '&blk_id=';
    }
    if ( (url.indexOf('&blk_id=')==-1) && (url.indexOf('?blk_id=')==-1) ) {
        url = url + sPrm + id;
    } else {
        url = url.substring(0, url.length-1) + id;
    }
    window.location.href = url;
}
-->

</script>

</head>

<body>

<div id="main-body">
  <h1>Example of conditional blocks</h1>
  <div class="w3cinfo"> this TBS template is W3C compliant <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml11" alt="Valid XHTML 1.1" height="31" width="88" style="border:none;" /></a> </div>
  <div id="example">
    <p>Conditional Blocks enable you to display or hide an area according to a condition.</p>
    <table width="500" border="1" cellpadding="2" cellspacing="0" style="border-color:#006699; border-collapse:collapse; border-width:2; margin-left:auto; margin-right:auto;">
      <tr>
        <td align="left" valign="top" style="background-color:#99CC33"><strong>Hello, You have selected the block #1.[onload_1;block=tr;when [var.blk_id]=1]</strong></td>
      </tr>
      <tr>
        <td align="left" valign="top" style="background-color:#FF9933"><em>Good, it's now the block #2 which is displayed.[onload_1;block=tr;when [var.blk_id]=2]</em></td>
      </tr>
      <tr>
        <td align="left" valign="top" style="background-color:#66FFCC; color:#990000">Well, finally Conditional Blocks are very easy.[onload_1;block=tr;when [var.blk_id]=3]</td>
      </tr>
      <tr>
        <td align="left" valign="top" style="background-color:#EBEBEB">This block is displayed by default.[onload_1;block=tr;default] </td>
      </tr>
    </table>
    <form action="[onshow..script_name]" method="post" id="frm_condition">
      <p style="text-align:center;">Select a block to display:
        <select name="lst_block" class="normal" id="lst_block" onchange="javascript:f_Select()">
          <option value="0">&lt;select a block&gt;</option>
          <option value="1">Block 1</option>
          <option value="2">Block 2</option>
          <option value="3">Block 3</option>
          <option value="x">[onshow.blk_id;ope=html;select]</option>
        </select>
      </p>
    </form>
  </div>
</div>
</body>
</html>