How To Include Only a Part of Another Page
Create your included page with “{$partn}” and “[!-- --]” markers (where n=1, 2, …) at the beginning and end of each block that you want to be able to selectively include or not.
That means: surround the first block of text, that may or may not be included with “{$part1}” and “[!-- --]”, the second block of text with “{$part2}” and “[!-- --]”, and so on.
Note that you may not use any Wikidot comment ([!-- … --]) within the source code of any of your optional blocks.
On your including page, if you want to have the first block included and the second block excluded, use e. g.
[[include name-of-included-page part1=[!-- --] | part2=[!-- ]]
Or, if you want to have the first block excluded and the second block included, use
[[include name-of-included-page part1=[!-- | part2=[!-- --] ]]
How it works
By specifying “partn=[!-- --]” you are replacing the “{$partn}” marker in the included page with an empty Wikidot comment ([!-- --]). So the marker is ignored and the block of text between it and the the empty comment at the end of the block is included as it is.
By specifying “partn=[!--” you are replacing the “{$partn}” marker in the included page with the start of a Wikidot comment ([!--) for which the empty comment at the end of the block acts as a comment end. As such, the block of text between the markers has been “commented out” and is ignored instead of included.
Example
Show first block, hide second
This is Part 1
Four lines
- One
- Two
- Three
- Four
Show second block, hide first
This is Part 2
Four more lines
- One
- Two
- Three
- Four
Show both blocks
This is Part 1
Four lines
- One
- Two
- Three
- Four
This is Part 2
Four more lines
- One
- Two
- Three
- Four
Links
A practical application of this concept can be found in Set Up An Infobox
Backlinks
Author
ErichSteinboeck. Please visit his/her userPage.



