Help:Template debugging

From TrainSpottingWorld, for Rail fans everywhere


<Frequently Asked Questions
This page is part of the Frequently Asked Questions help scheme.


Help! I've copied a WP template to TSW and it's gone all screwy!!

Wikipedia is more fault-tolerant about certain formatting codes than TSW. Hence, a 'faulty' (poorly debugged) template or page copied from WP can look OK 'over there', but strange 'over here'.


Some problems to look out for:

Outer frame areas overwrite main display pane

Possibly the worst, as it may not be possible to even see the 'save' button, which is kind of tricky!

Probably means that you have unmatched pairs of <div></div>, in this case, not enough </div>s. (See note [1])


All text/boxes missing from left-hand side of page

Probably means that you have unmatched pairs of <div></div>, in this case, not enough </div>s. (See note [1])


Outer frame displays small font

Probably means that you have unmatched pairs of <div></div>, in this case, too many </div>s. (See note [1])


All text has gone to courier font

Check that each <code> has a matching </code>. Can be caused by a missing '/'.


The documentation page is (literally!) loopy

The symptoms are the presence of a TOC box and recursive text in the documentation pane.

This is caused by the use of {{BASEPAGENAME}}, which is supposed to pick out the name of the template, but seems to work unpredictably here. The solution is to replace all instances of {{BASEPAGENAME}} with the name of the template (ie 'foo', for 'Template:foo'). Check both template page and its documentation, as it may take several iterations for each to sort itself out.

Notes

  1. 1.0 1.1 1.2 Note that in the case of '/div' codes, the matching 'div' may not be visible in the editing area.
    Don't worry about this, just make it look right in preview and you should be fine!
    However, do take care where the '/div' codes are placed, or undesirable effects may be seen.