JHTMLContent/prepare: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Fire onPrepareContent for content that isn't part of an article.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JHTMLContent/prepa... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 58: | Line 58: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=prepare | category=prepare | ||
category=JHTMLContent | category=JHTMLContent | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Latest revision as of 00:39, 25 March 2017
Description
Fire onPrepareContent for content that isn't part of an article.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
prepare($text, $params=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $text | The content to be transformed. | |
| $params | null | The content params. |
Returns
string The content after transformation.
Defined in
libraries/joomla/html/html/content.php
Importing
jimport( 'joomla.html.html.content' );
Source Body
function prepare($text, $params = null)
{
if ($params === null) {
$params = array();
}
/*
* Create a skeleton of an article. This is a bit of a hack.
*/
$nodb = null;
$article = new JTableContent($nodb);
$article->text = $text;
JPluginHelper::importPlugin('content');
$dispatcher = &JDispatcher::getInstance();
$results = $dispatcher->trigger(
'onPrepareContent', array (&$article, &$params, 0)
);
return $article->text;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples