This is an old revision of the document!


Data Command

The Data command allows areas of text to be marked as data, and therefore ignored by the PTP engine. These areas can contain PTPScript code, Placeholder symbols, etc. without being processed as PTPScript code. For instance, one use would be to mark an area of CSS or JavaScript in a webpage, so that the PTP engine would not try to evaluate it.

There is just one command in to the Data family - the Data command itself. It consists of the command followed by a set of characters that will be used to signal the end of the data sequence. These characters can be any characters except curly braces - { } - as these are used to denote PTP placeholders.

For example:

{ data !!!END_OF_DATA!!! }
//  Handy JavaScript function to pad numbers
    function pad(number, places) {
        if (number.toString().length > places) {
            return number.toPrecision(places);
        } else {
            var str = number.toString();
            while (str.length < places) {
                str = '0' + str;
            }
            return str;
        }
    }
!!!END_OF_DATA!!!

//  Handy JavaScript function to pad numbers
    function pad(number, places) {
        if (number.toString().length > places) {
            return number.toPrecision(places);
        } else {
            var str = number.toString();
            while (str.length < places) {
                str = '0' + str;
            }
            return str;
        }
    }

In the example above, a section of JavaScript code is marked as a data sequence, and is correspondingly left as-is by the PTP engine.

Data commands can appear within other command structures, but cannot be nested within other Data sequences.

~~DISCUSSION~~

ptpscript/commands/data.1148908331.txt.gz · Last modified: 2006/06/27 01:47
 
 
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki