Page Blocks

Hosting sponsored by:

Point In Space

 

API: Num

Filename:
fwpNum_int.ctag

Released With:
5.0.0

Current Version:
1.0.0

Status: Active

Min Lasso Tested: 8.1.0

Max Lasso Tested: 8.5.3

Related:

Still don't get it?

Check out the talk list archives, or join and ask your questions.

Documentation Error or Request?

Email documentation corrections or comments

API Reference

fwpNum_int (Tag)

Description

Formats a specified number into integer format.

Uses the character specified by $fw_numGroupChar to separate thousands, etc. Therefore, it can create numbers in 123,345,678 and 123.345.678 formats.

Syntax

[fwpNum_int: integer|decimal]

Examples

[fwpNum_int: 31415] results in 31,415

[fwpNum_int: (field:'population')]

Source Code

View in separate window

<?lassoscript
//............................................................................
//
//    pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*

    {fileName=        fwpNum_int.ctag }
    {rsrcType=        tag }
    {rsrcName=        fwpNum_int }
    {rsrcHTTP=        www.pageblocks.org/refc/fwpNum_int }

    {lassoVrsnMin=    8.1.0 }
    {lassoVrsnMax=    8.5.3 }

    {author=        Greg Willits }
    {authorEmail=    subscribe to pbTalk at www.pageblocks.org/talk/ }
    {authorHTTP=    www.pageblocks.org }

    {desc=            formats an integer with thousands separators }

    {maintvsrn=        1.1 }
    {maintrelease=    5.2.5 }
    {maintdate=        2006-07-23 }
    {maintauthor=    Greg Willits }
    {maintnotes=    added comma stripping so strings like 1,000 would
                     convert properly }

    {maintvsrn=        1.0 }
    {maintrelease=    5.0.0 }
    {maintdate=        2006-01-16 }
    {maintauthor=    Greg Willits }
    {maintnotes=    initial release }

*/
//............................................................................

define_tag:'fwpNum_int', -priority='replace';

    local:'fw_num' = string:(params->get:1);
    #fw_num->(replace:',','');
    #fw_num = integer:#fw_num;

    #fw_num->(setformat: -groupchar=($fw_client->'thousandsChar'));

    return: #fw_num;

/define_tag;
?>

© 2002-2012, pageblocks.org