PostNuke Help |
||
|---|---|---|
Previous |
Next |
|
prepare variable for display, preserving some HTML tags
mixed pnVarPrepHTMLDisplay(var, ...);
pnVarPrepHTMLDisplay() takes a variable number of var arguments and for each one carries out suitable escaping of characters such that when output as part of an HTML page the exact string is displayed, except for a number of admin-defined HTML tags which are left as-is for display purposes.
If pnVarPrepHTMLDisplay() is only passed a single var argument then it returns the corresponding display-ready variable. If pnVarPrepHTMLDisplay() is passed multiple arguments then it returns an array of corresponding display-ready variables. This function returns void if an exception was raised.
This function doesn't raise exceptions but throws back exceptions raised from other functions.
pnVarPrepHTMLDisplay() should be used with great care, as it does allow certain HTML tags to be displayed.
The HTML tags that will be displayed are those defined in the configuration variable AllowableHTML, which is set on a per-instance basis by the site administrator.
Running pnVarPrepHTMLDisplay() multiple times is cumulative, as is running a combination on pnVarPrepHTMLDisplay() and pnVarPrepForDisplay(), and is not reversible. It recommended that variables that have been returned from pnVarPrepHTMLDisplay() are only used in output functions, and then discarded.
// Get the home and body text of a story (allow specified HTML tags through)
list($hometext,$bodytext) = pnVarPrepHTMLDisplay($hometext, $bodytext);
// Print some output - numer should not have
// HTML tags in it, so use pnVarPrepForDisplay rather than pnVarPrepHTMLDisplay
$html = "Home text is $hometext<p>
Body text is $bodytext<p>
Story number is " . pnVarPrepForDisplay($storynum) . "<p>
Notes are " . pnVarPrepHTMLDisplay($bodytext) . "<p>";
Previous |
Next |