ਸਮੱਗਰੀ 'ਤੇ ਜਾਓ

ਫਰਮਾ:TranscludeBox

Wikibooks ਤੋਂ
[[ਫਰਮਾ:{{{2}}}|v]]·[[ਫਰਮਾ ਗੱਲ-ਬਾਤ:{{{2}}}|d]]·e
{{{1}}}

{{ ਫਰਮਾ:{{{2}}} }}


Documentation

[ਸੋਧੋ]

A DropBox whose contents are transcluded from elsewhere. This is useful for maintaining the contents of text boxes in a set of subpages. A relative link is is passed to this template and it is automatically transcluded as the contents of the box. When writing a book, this separates the contents of each information box from the main page: usually a desirable feature.

The contents of the box can be accessed directly by using the v d e (view, discuss, edit) links in the box title.

Parameters

[ਸੋਧੋ]
header
The heading for the box (e.g. Box 1.1). This can also be taken from the 1st unnamed parameter.
Box contents are specified by one of the following
relpath
A relative path to the content of the box. This can also be taken from the 2nd unnamed parameter.
abspath
Instead of a relative path, use an absolute path (this currently does not give the correct link to the discussion page)
tplname
Instead of the relative or absolute paths, give a template name, e.g. Lorem

Conventional css parameters

[ਸੋਧੋ]
fw1
the font-weight for the heading
fw2
the font-weight for the body
bg
the background-color for the enclosing box
bg1
the background-color for the heading
bg2
the background-color for the body
ta1
the text-align for the heading (default center)
ta2
the text-align for the body (default left)
float
should the box be floated? (left, right, or none)
width
the width of the box, e.g. 33%

Special parameters

[ਸੋਧੋ]
hidden
set this to any string (e.g. hidden=true) to have the box hidden by default
headType
allows you to set the box header to (say) "h4", which means it will be included in the table of contents

Examples

[ਸੋਧੋ]

Also see Template:DropBox#Examples for examples of other possible stylings.

The simplest example. In this documentation we can transclude Template:Lorem using a relative link, because the documentation is aslo in the template namespace. In most cases, you will probably want to transclude a page in the same namespace as your book, so you will want to use a relative link.

{{TranscludeBox|Box 1.1|../Lorem}}

or we could be more verbose, and give the parameter name

{{TranscludeBox|Box 1.1|relpath=../Lorem}}
v·d·e
Box 1.1

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


If we want to transclude a template in a page that is outside the Template namespace, we can't use a relative link, so we have to specify tplname rather than relpath.

{{TranscludeBox|Box 1.2|tplname=Lorem}}
v·d·e
Box 1.2

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


An example where the headType has been set. Note that if the title is an unnamed parameter, make sure it is not followed by a carriage return, otherwise it will not appear in the TOC.

{{TranscludeBox|Box 1.3|../Lorem|headType=h4}}
v·d·e

Box 1.3

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


v·d·e

Box 1.4

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


A more realistic example, rendered as (hopefully) seen on the right

{{TranscludeBox|Box 1.4|../Lorem|
headType=h4|
bg=#BBBBFF|
bg1=#BBBBFF|
bg2=white|
float=right|
width=33%}}

See also: Template:PrintTranscludeBox, for how this template will be rendered in a collection.