Jmeth/doc
From Joomla! Documentation
< Template:Jmeth
It contains usage information, categories and other content that is not part of the original template page.
To view the template page itself, see Template:Jmeth.
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 foo() -- regular method notation - {{
jmeth|JWhatever|bar|&
}} gives &bar() -- return by reference notation - {{
jmeth|JWhatever|bat|
}} gives bat() - bat()
- {{
jmeth|JWhatever|_
}} gives _() -- "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.)