API15

API15:JHTMLContent/prepare

From Joomla! Documentation

Revision as of 22:16, 22 March 2010 by Doxiki (talk | contribs) (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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Description

Fire onPrepareContent for content that isn't part of an article.

[Edit Descripton]

Template:Description:JHTMLContent/prepare

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;
}

[Edit See Also] Template:SeeAlso:JHTMLContent/prepare

Examples

<CodeExamplesForm />