Template

Jmeth

From Joomla! Documentation

Method.png

[[Framework:{{{1}}}/{{{2}}}|{{{2}}}()]]

[view] [edit] [history]

Template-info.pngTemplate documentation

Creates a link to a Class Method in the Joomla! Framework.

See #Known issues below about the trouble with static and private methods starting with an underscore in their name (_) and how it has been solved.

Usage[edit]

{{jmeth|class|method|[byref]}} Examples

  • {{jmeth|JWhatever|foo}} gives
    Method.png
    foo() -- regular method notation
  • {{jmeth|JWhatever|bar|&}} gives
    Method.png
    &bar() -- return by reference notation
  • {{jmeth|JWhatever|bat|}} gives
    Method.png
    bat()
  • Method.png
    bat()
  • {{jmeth|JWhatever|_}} gives
    Method.png
    _() -- "magic" underscore trick _ (U+005D) vs ‗ (U+2017)

Parameters[edit]

Parameter Name Parameter Description req./opt.
{{{1}}} name of class, i.e JObject Required.
{{{2}}} name of method, i.e toString Required.
{{{3}}} by-ref prefix, given literally as & optional.

Known issues[edit]

Several classes contain static methods called "_" (underscore) such as JHTML::_ and JText::_
In Mediawiki the underscore character is a placholder for the space character in page titles. In order to have a page named "_" these pages are renamed using the double underscore Unicode character U+2017: ‗ -- This template takes care of the issue.

If a subpage is supposed to be named "_", like JHTML/_, Mediawiki will remove this leading space which results in the pagename to become JHTML/ -- a trailing slash. This is a legitimate name for a page in MW (at least up to 1.11), but nobody would be able to find it... To prevent dead links for these (rare) pagenames, the page [[JHTML/_]] (given wih an underscore) will redirect to JHTML/‗ (double underscore, the real page.)

Chunk:Framework templates/API templates