Loading...
 
Skip to main content

History: Making columns for wiki content

Source of version: 27

Copy to clipboard
            {maketoc}

! Introduction
In days gone by, HTML tables were used to lay out web page content, but with the invention of cascading style sheets, divs have replaced tables as the preferred containers of content on a web page. To encourage Tiki site authors to use up-to-date layout methods, here is some syntax that enables easy layout of two, three, or four columns on a wiki page. 

Of course Tiki's wiki syntax for tables can still be used where it's appropriate: for tabular data.

''wiki syntax:''
||::__Cool Web layout method__::
1990s | HTML tables
Today | CSS (divs, etc.) ||

''FANCYTABLE'' plugin:
{FANCYTABLE(head="Column 1 | Column 2")}Row 1 Column 1 | Row 1 Column 2
Row 2 Column 1 | Row 2 Column 2
Row 3 Column 1 | Row 3 Column 2{FANCYTABLE}

But for correct semantic layout of general page content, tables aren't appropriate and should be avoided, which is where this floated box method works well.

! Also for L&F custom code
Site admins, these same CSS classes can be used in Look and Feel custom code areas - site header, top bar, center column heading, and bottom bar - if you want to have two or more columns of content in any of those areas.

! Procedure
Each place where columns are wanted, add a div with the appropriate class -- ''halffloat'', ''thirdfloat'', or ''quarterfloat'', depending on if there are to be two, three, or four columns, and the class ''clearfix''.  Clearfix ensures that the background or border will go down around all the floated divs, and that the content of this div won't overlap or be overlapped by the content below it.

If a div is used instead of a module within the halffloat, etc. it needs to have the class ''box''. See example below. Combinations of non-module divs and modules are also ok.

! Examples
!! Two columns
{DIV(class="col-md-6 clearfix")}
{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}

is produced by:

{CODE(wrap="1")}{DIV(class="col-md-6 clearfix")}
{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}{CODE}

!! Three columns
{DIV(class="thirdfloat clearfix")}
{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}

produced by

{CODE(wrap="1")}{DIV(class="thirdfloat clearfix")}
{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}{CODE}

and
!! Four columns
{DIV(class="quarterfloat clearfix")}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}

produced by 

{CODE(wrap="1")}{DIV(class="quarterfloat clearfix")}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{MODULE(module=random_pages)/}{DIV}{CODE}

Boxes can have any content, not just a module, like this (''Sorry but this part of the demo is temporarily out of order in Tiki 4.0. It is fixed in the code for TIki 4.1. In the meantime, for the non-module columns to display side by side, their div class="box" must have a 'style=float:left !important" rule added inline.'') :

{DIV(class="halffloat clearfix")}{DIV(class="box")}Lorem Ipsum is slechts een proeftekst uit het drukkerij- en zetterijwezen. Lorem Ipsum is de standaard proeftekst in deze bedrijfstak sinds de 16e eeuw, toen een onbekende drukker een zethaak met letters nam en ze door elkaar husselde om een font-catalogus te maken. Het heeft niet alleen vijf eeuwen overleefd maar is ook, vrijwel onveranderd, overgenomen in elektronische letterzetting. Het is in de jaren '60 populair geworden met de introductie van Letraset vellen met Lorem Ipsum passages en meer recentelijk door desktop publishing software zoals Aldus PageMaker die versies van Lorem Ipsum bevatten.{DIV}{DIV(class="box")}Lorem Ipsum é um texto modelo da indústria tipográfica e de impressão. O Lorem Ipsum tem vindo a ser o texto padrão usado por estas indústrias desde o ano de 1500, quando uma misturou os caracteres de um texto para criar um espécime de livro. Este texto não só sobreviveu 5 séculos, mas também o salto para a tipografia electrónica, mantendo-se essencialmente inalterada. Foi popularizada nos anos 60 com a disponibilização das folhas de Letraset, que continham passagens com Lorem Ipsum, e mais recentemente com os programas de publicação como o Aldus PageMaker que incluem versões do Lorem Ipsum.{DIV}{DIV}

produced by: 

{CODE(wrap="1")}{DIV(class="halffloat clearfix")}{DIV(class="box")}Lorem Ipsum is slechts een proeftekst uit het drukkerij- en zetterijwezen. . . .{DIV}{DIV(class="box")}Lorem Ipsum é um texto modelo da indústria tipográfica e de impressão. O Lorem Ipsum tem vindo a ser o texto padrão usado por estas indústrias desde o ano de 1500. . . .{DIV}{DIV}{CODE}

!! Mix of modules and other divs
{DIV(class="halffloat clearfix")}{DIV(class="box")}
!! Lorem Ipsum
Lorem Ipsum is slechts een proeftekst uit het drukkerij- en zetterijwezen. Lorem Ipsum is de standaard proeftekst in deze bedrijfstak sinds de 16e eeuw, toen een onbekende drukker een zethaak met letters nam en ze door elkaar husselde om een font-catalogus te maken.{DIV}
{MODULE(module=random_pages)/}{DIV}

produced by

{CODE(wrap="1")}{DIV(class="halffloat clearfix")}{DIV(class="box")}!!Lorem Ipsum
Lorem Ipsum is slechts een proeftekst uit het drukkerij- en zetterijwezen. Lorem Ipsum is de standaard proeftekst in deze bedrijfstak sinds de 16e eeuw, toen een onbekende drukker een zethaak met letters nam en ze door elkaar husselde om een font-catalogus te maken.{DIV}
{MODULE(module=random_pages)/}{DIV}{CODE}

!Bootstrap from Tiki13

From Tiki13 we use the responsive Twitter Bootstrap design framework to determine the layout and design of Tiki.

Then a similar effect will be made with a different method.
As in Bootstrap the full width of a div is a part of 12 gutters, a number of 1 to 12 elements can be put besides each other, each in a div, using the column classes of Bootstrap. The column classes determine the relative with of the elements and the "breakpoints" based on device width (@media queries), when the elements get vertically stacked (mobile device, tablet, smartphone or shrinking the browser width). 

__Some examples:__

Please mind, that adding the width parts of the class name (the number) must give 12 when added (6+6 or 4+4+4 or 2+2+2+6 or 3+4+3+2 etc.)

The ~np~{DIV(class=row)}~/np~ wraps together the 12-gutter side by side elements and "clearfixes" the content to the following part of the page (or custommodule or template, if used with html -> div class="row").

"content" refers to arbitrary elements like text, modules, wikiplugins ... 

3 Elements equal width (three times -4), 'side by side' - switching to 'vertically stacked' at lower than medium (-md-) with:
{CODE()}
{DIV(class=row)}
{DIV(class=col-md-4)}content{DIV}
{DIV(class=col-md-4)}content{DIV}
{DIV(class=col-md-4)}content{DIV}
{DIV}
{CODE}

2 Elements equal width (twice -6), 'side by side' - switching to 'vertically stacked' at lower than large (-lg-) with:
{CODE()}
{DIV(class=row)}
{DIV(class=col-lg-6)}content{DIV}
{DIV(class=col-lg-6)}content{DIV}
{DIV}
{CODE}

4 Elements different width, 'side by side' - switching to 'vertically stacked' at lower than small (-sm-) with:
{CODE()}
{DIV(class=row)}
{DIV(class=col-sm-3)}content{DIV}
{DIV(class=col-sm-3)}content{DIV}
{DIV(class=col-sm-2)}content{DIV}
{DIV(class=col-sm-4)}content{DIV}
{DIV}
{CODE}

The Bootstrap grid layout can work as well in Tiki 12 and earlier Tiki versions if the grid CSS rules are gotten from bootstrap.css (available at http://getbootsrap.com) and put in a theme stylesheet or separate CSS file that's imported by the theme stylesheet. There's no need to use other files such as Javascript files simply to have the grid layout. 

In Tiki 12, you may also be able to use a Tiki 13 (or "trunk" development version of Tiki, prior to the release of Tiki 13) version of templates/layouts/.../layout_view.tpl, to have the grid rules applied to the module zones and left, right and main columns of the page.

        

History

Advanced
Information Version
Mon 13 of Jun, 2016 04:47 GMT-0000 Gary Cunningham-Lee URL corrected to fix 404 error. 30
Sun 10 of Aug, 2014 13:19 GMT-0000 Gary Cunningham-Lee Information updated for Bootstrap compatibility. 29
Sun 10 of Aug, 2014 12:40 GMT-0000 Gary Cunningham-Lee 28
Sun 10 of Aug, 2014 12:40 GMT-0000 Gary Cunningham-Lee Replaced class "halffloat" with "col-md-6". 27
Tue 28 of Jan, 2014 07:14 GMT-0000 Gary Cunningham-Lee Tips about using Bootstrap grid rules in pre-Tiki 13 versions. 26
Sun 15 of Dec, 2013 20:45 GMT-0000 Torsten Fabricius just args 25
Sun 15 of Dec, 2013 20:43 GMT-0000 Torsten Fabricius forgot ~np~ noparse ~/np~ 24
Sun 15 of Dec, 2013 20:40 GMT-0000 Torsten Fabricius tried to make my bad English to a bit less bad English 23
Sun 15 of Dec, 2013 20:32 GMT-0000 Torsten Fabricius {toc} sucked - did need {maketoc} - replased, sorry for dumbness 22
Sun 15 of Dec, 2013 20:31 GMT-0000 Torsten Fabricius added {toc} and a foresight to a Bootstrap method 21
Tue 03 of Aug, 2010 08:19 GMT-0000 Carsten Aevermann 20
Sun 13 of Dec, 2009 05:32 GMT-0000 Gary Cunningham-Lee minor text correction. 19
Tue 01 of Dec, 2009 03:44 GMT-0000 Gary Cunningham-Lee Note added about temporary problem and workaround. 18
Sun 18 of Oct, 2009 17:15 GMT-0000 Gary Cunningham-Lee Corrected spelling. 17
Sat 17 of Oct, 2009 08:25 GMT-0000 Gary Cunningham-Lee Added a little transition text. 16
Sat 17 of Oct, 2009 08:21 GMT-0000 Gary Cunningham-Lee Fancytable example added. 15
Mon 12 of Oct, 2009 14:46 GMT-0000 Gary Cunningham-Lee Forgot to add clearfix class to 3-column example. 14
Mon 12 of Oct, 2009 08:41 GMT-0000 Gary Cunningham-Lee 13
Mon 12 of Oct, 2009 08:38 GMT-0000 Gary Cunningham-Lee 12
Mon 12 of Oct, 2009 08:33 GMT-0000 Gary Cunningham-Lee 11
Mon 12 of Oct, 2009 08:29 GMT-0000 Gary Cunningham-Lee 10
Mon 12 of Oct, 2009 08:08 GMT-0000 Gary Cunningham-Lee 9
Mon 12 of Oct, 2009 08:06 GMT-0000 Gary Cunningham-Lee 8
Mon 12 of Oct, 2009 08:01 GMT-0000 Gary Cunningham-Lee 7
Mon 12 of Oct, 2009 07:50 GMT-0000 Gary Cunningham-Lee 6
Mon 12 of Oct, 2009 07:48 GMT-0000 Gary Cunningham-Lee 5
Mon 12 of Oct, 2009 07:46 GMT-0000 Gary Cunningham-Lee 4
Mon 12 of Oct, 2009 07:45 GMT-0000 Gary Cunningham-Lee 3
Mon 12 of Oct, 2009 07:39 GMT-0000 Gary Cunningham-Lee 2
Mon 12 of Oct, 2009 07:38 GMT-0000 Gary Cunningham-Lee 1