MakeColumns
Question
How can I create columns without adding all that table markup code?
Answer
This handy little script lets you select where the split in the text should be. This recipe then puts the n bits of text into a n-column table.
Put make_columns.php
in your cookbook/directory
, and rename 'make_columns.php
'.
Add the following line to local/config.php
include_once("$FarmD/cookbook/make_columns.php");
This recipe provides very simple markup to allow a page to contain a section sub-divided into n columns of equal width, and optionally allows full-width text above and below the n-column section. Note the restriction here is that there can only be one section per page that is broken into columns. The recipe provides exact control so the editor can decide where to put the split
(:colstart:)
-- This markup tag allows the editor to indicate where the column block of text begins. All text before this tag will appear above the two-column block.
(:colend:)
-- This markup tag allows the editor to indicate where the columns should end. Any text after this tag will appear after the n-column block.
(:column:)
-- this markup tag tells the recipe where to split the columns. As this recipe does not attempt to calculate where an equidistant split should be, it is up to the editor to decide where. If you add this directive n-1 times in your content, then it creates a n-column table of your content where the content before the n-th column will be added to the n-th column.
Notes
Versions
- 2023-06-17 : Make Columns - version 0.2 - HarcoKuppens? - Fixed broken Markup and extended recipe from 2 columns to the general n-th column version.
- 2005-09-22 : Make Columns - version 0.1 - BenWilson
Initially written
- 2005-10-04 : Make Columns - version 0.2
It appears Andreas added the (:colend:)
tag to the markup.
- 2005-10-04 : Make Columns - version 0.3
- 2005-11-20 : Make Columns - version 1.0 - BenWilson
- added stripslashes fix.
- added class to the table for CSS markup.
This recipe was last tested on PmWiki version: 2.3.22
See Also
- Columns Create columns out of lists without using table markup
- CreateColumns quickly divides up a list of items into separate columns within a table
- MakeColumns Create columns on a page without using tables.
- MakeManyColumns How to make columns on a page using CSS
- MultiColumn Allow text to flow into multiple columns
Contributors
Comments
See discussion at MakeColumns-Talk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.