This topic is locked

Echoing Information in Before Process Event

9/18/2011 7:04:18 PM
PHPRunner Tips and Tricks
E
electromotive author

In the help and many forum posts, there are examples of displaying extra information in some events, such as Before Process. The problem with using Echo statement in these events is that it generates non-compliant HTML, the display appears before the <HTML> tag, and you can't use the styles/CSS available. Worse, such practice often prevents the page from working properly. If you plan on leaving displays in your project a better and more versatile & reliable way to do these displays entails putting the text string into a variable and then displaying it in the Before display event. There are 3 steps for this.
First, use the HTML editor to insert a tag into the HTML using the code view. I put mine just after {BEGIN body}{$debug_text}
Then, in the Before display event add:



if (isset($_SESSION["debug_text"])) {

$xt->assign("debug_text",$_SESSION["debug_text"]);

}


Then in any event preceding, like maybe in List page: Before SQL query, add your display HTML like:



global $strTableName;

// display trace of search (in before display event)

$QJ = "<DIV>".$strTableName." ";

$QJ .= "strWhereClause: ".$strWhereClause."
";

$QJ .= "</DIV>";

$_SESSION["debug_text"]= $QJ;



You can also package the text (ie., within a DIV) in the Before display event, rather than earlier so you assemble text from several prior events.