BLHTML.org

BLHTML.org / Web Programming / BLHTML / BLHTML Manual / BLHTML funktion list / BLHTML funktion list /

 
  DATA 4979 11
#DATA# is a database function
Rights to use this function #DATA:
  • Data manager
  • BASIC

  • #DATA# Är en variable and string handler. #DATA# Manage även posts from table.

    values:  defaults:    description:
    postpreviewStep in the table
    nextStep in the table
    hiddenMake data to html hidden
    newVisitors can input new value
    websafeShowing variable without space to be used in a webaddress
    showDisplaying Data
    setSet value to $variable
    tabindexpost=new Sets tabindex on htmlobject
    typepost=new Type of html object
    readonlytruepost=new Objects only for reading
    maxlengthpost=new Maximum number of characters that may be fed into the textfield
    inkTextcolor for new
    paperBackground color for new
    cols44TEXTAREA width for new
    rows8TEXTAREA rows for new
    sizecolsCharacter width on textfield for new
    classCSS class on object
    idcurrent accountData account / table to be read from (preview/next)
    post=new sets id.name on html object id
    titlepost=new title="shows mouseover title description"
    queryAsk the table where key field is query
    whereSQL SELECT where-case
    fieldlist#DATA[var[+]] post=set type=fieldlist where(order=$order)#
    operatoraddAdds value to $variable
    subSubtracts value to $variable
    mulMultiplies value to $variable
    divDivides value to $variable
    blhtmloffDo not BLHTML execute value
    on#DATA[name] value(data)# value will be BLHTML executed
    all#DATA[name] value(data)# name and value will be BLHTML executed
    valueValue on data $variable
    bitbit handling on number values
    arrayManage list elements

    More information:
  • basket
  • Assignment hierarchy with DATA
  • Variable handling
  • BLHTML syntax
  •   array 1918 0
    Manage list elements with #DATA#
    Guidelines for listelement:
    • Listelementet är noll litterat (forsta elementet är 0)
    • Listelement följer Assignment hierarchy with DATA
    • #$arrname[+](0 1 2 3...)# Declare arrayen $arrname där forsta elementet heter 0 and andra 1 osv...
    • #$user[*](0(null)name(Adam)sure(Boll)no(123)...)# Declare arrayen $user där forsta elementet heter 0=null and andra name=Adam osv...
    • #$testarray[-] return=ArrayName# returnerar a list with $testarray surename and save it in variable $ArrayName
    Example att declare ett listelement:
    // Example 1:
    #DATA[test1_array[+]] post=set value(() this is (four) () (six) (in the array) (eight))#

    // Example 2:
    #
    DATA[test1_array[*]] post=set
    value(
            0()
            1=this
            2=is
            3(four)
            4()
            5='six'
            6='in the array'
            7="eight"
    )         
    #

    variable:  contents:  
    $test1_array[0]=
    $test1_array[1]=this
    $test1_array[2]=is
    $test1_array[3]=four
    $test1_array[4]=
    $test1_array[5]=six
    $test1_array[6]=in the array
    $test1_array[7]=eight

    Example att plocka ut element:
    #SET_CATCH_PAGE#
    #DATA[no[+]] post=set value(null one two tree four five six seven eight nine ten)# // Declare the array $no

    #DATA[no[3]]#<br> // tree

    #DATA[n] post=set value=5# #DATA[no[$n]]#<br> // five

    #DATA[eight] post=set value=8#
    What is variable $eight? Awnser it's #DATA[eight] array=no#<br><br> // Here it pick the 8 element name from the array $no

    #+#DATA[no[#DATA[dropdown] array=no#]]#+# = #$dropdown#<br><br>

    Dropdown:<br>
    #DATA[dropdown] post=new type=dropdown value($no[+])#<br>

    #PLOPP value=Update#

    Returns:
    tree
    five
    What is variable $eight? Awnser it's 8

    the 8 element name from the array $no #DATA[no[0]]# = null

    Dropdown:


    More information:
  • Variable handling
  • Array handling
  • #ARRAY#
  • Assignment hierarchy with DATA
  • #DATA#
  • dropdown
  • post=new
  • #IF#
  • SCORE example
  •   bit 1315 0
    #DATA[variable] bit#

    #DATA[variable] bit# take out a bit from a variable.
    H1 in Administrera Database står for Heltal and size 1 byte
    Ett H1 field can save 8 bitar medans en H3 saves 24 bitar.

    Value in #DATA# som manage bitar:
  • new
  • show
  • set
  • checkbox

  • Example att count bitar with tal 23:
    bit  värde  23    Uträckning: delsumma + bit * bitvärde = new delsumma
    0110  + 1 * 1= 1
    1211  + 1 * 2= 3
    2413  + 1 * 4= 7
    3807  + 0 * 8= 7
    41617  + 1 * 16= 23
    532023 + 0 * 32= 23
    664023 + 0 * 64= 23
    7128023 + 0 * 128= 23

    Samma example stegvis:
    1 + 2 + 4 + 0 + 16 + 0 + 0 + 0 = 23

    Example 3 binära checkboxar saves in ett field in table:
    #DATA[blhtml_table] post=set value=dbname type=hidden#

    #READ value=10#

    #DATA[checkbox1_checkbox] post=hidden value=1#
    // Inform the basket it's a checkbox
    #DATA[checkbox1] post=new type=checkbox bit=0#
    #DATA[checkbox1] post=new type=checkbox bit=5#
    #DATA[checkbox1] post=new type=checkbox bit=6#

    #PLOPP value=Update#


    /*
    #DATA[blhtml_table]# make page data been send to basket and the table is dbname

    #READ value=10# read post where the key is 10

    Write out 3 checkbox where data stored in checkbox1
    #PLOPP value=Update# send the form to the basket, if checkbox1 is an field in table dbname then it save the bit sum to the table.
    */

    #DATA[blhtml_table]# talar if att datapage skall skickas to basket and account heter dbname

    #READ value=10# läser in post där key field är 10

    Writes ut 3 checkboxar där variable är checkbox1
    #PLOPP# skickar formulär to basket, if checkbox1 är ett field in table updates checkboxarnas binära values in checkbox1.

    Example to check if bit 3 är satt:
    #IF(#DATA[ch1] bit=3#)
            then(bit 3 in variable ch1 är on)
            else(bit 3 in variable ch1 är av)
    #

    More information:
  • #DATA#
  •   operator 1482 0
    #DATA[variable] post=set operator#

    #DATA[variable] post=set operator# Räknar tal and field.

    values:  defaults:  description:
    operatoraddAdds to Data
    subSubtracts to data
    mulMultiplies to data
    divDivides to data

    NOTE that this function does not work in other functions.
    #DATA[n] post=set value=100# // Assign #DATA[n]#/$n att bli 100

    Example on räknare då 5 är 100:
    #DATA[n] post=set operator=add value=1# // Adderat 1 to #DATA[n]#/$n
    #DATA[n]# // Writes ut 101

    Example att räkna with field:
    #DATA[n] post=set value=0#
    #DATA[a] post=set value=3#
    #DATA[b] post=set value=15#

    #DATA[n] post=set operator=add value=$b# // Adderat 15 to #DATA[n]# / $n
    #DATA[n]#<br> // Writes ut 15

    #DATA[n] post=set operator=div value(#SUM value=$a#) blhtml=on# // Delar with 3 to #DATA[n]# / $n
    #DATA[n]#<br> // Writes ut 5

    #DATA[n] post=set operator=add value(#SUM value($b 32.5 * 2)#) blhtml=on#
    // Adderar 2(15 + 32.5) to #DATA[n]# / $n
    // Calculation: 2(15 + 32.5) + 5 = 100
    // BLHTML räknar: b 32.5 * 2 + a = 100
    #DATA[n]# // Writes ut 100

    More information:
  • #DATA#
  • #SUM#
  •   where 1415 0
    #DATA[variable] post=set where#

    where is part of an SQL-question asked along with the SELECT-case:
    SELECT field from table where

    NOTE! where do not unset the $variable it add the result from the where-case:
    $variable = $variable + "outcome from where-case"
    it become a BLHTML array and not a normal string!

    Example, to first unset $variable then use:
    #DATA[variable] post=set where(id = 100) value=NULL#
    • #DATA[variable] post=set value# set value to $variable
    • #DATA[variable] post=set where# get value form field variable from current account
    • #DATA[variable] id=11 post=set where type=fieldlist# create a BLHTML array from data account / table 11
    Attributes to #DATA[field] post=set where#:
    values     standardvalue       description:
    idcurrent accountData account / table where function shall read from
    whereSQL where-cast to read one post
    blhtmlblhtml=on BLHTML execute where-case
    returnreturn=variable stores the results in $variable

    Example, retrieve a value from a post in the table:
    #DATA[id] post=set value=1# // #$id=1#
    #DATA[info] id=10 post=set where(id = #DATA[id]#) blhtml=on#
    #DATA[info] id=10 post=set where(id = $id)#
    // Simplified is recomended!
    // Here the contents include field info, from table 10 where id = 1 to $info

    Read field id return the result to $who:
    #$buddy=accountame#
    #DATA[id] id=2 where(user='$buddy') return=who#


    who=#$who#

    fieldlist
    type=fieldlist make a list from the keyfield from current data account and store the result in a BLHTML array
    #DATA[array] post=set type=fieldlist# // $array make a text string from the keyfields
    #DATA[array[+]] post=set type=fieldlist# // $array[0] = is the first keyvalue from current data account / table
    #DATA[array[*]] post=set field=rubric type=fieldlist#
    // $array[key_field_name] = "value" from current data account / table

    Attributes for #DATA[variable] post=set where type=fieldlist#:
    value     standardvalue       description:
    idcurrent accountData account / table where function shall read from
    whereSQL where-cast to read many posts
    type
    fieldkey fieldField where data shall retrieves from
    blhtmlblhtml=on BLHTML execute where-case

    Example, pick some selected posts from a table:
    #DATA[post_pos] post=set value=10# // #$post_pos=10#
    #DATA[do] post=set value=10# // #$do=10#
    #DATA[name_array]
            id=10 post=set field=name
            where(id >= $post_pos and id <= #SUM value($post_pos $do)#)
    blhtml=on
    #

    // name_array get assigned with name field from data account / table 10 as a BLHTML array
    // where id >= 10 and id <= 20

    More information:
  • basket
  • #READ#
  • #ECHO#
  • #DATA#
  • MySQL SELECT
  •   query 1145 0
    #DATA[variable] post=set query# set the keyfield in the table that going to use post=preview / next

    Example:
    #DATA[nx] id=33 post=next query=n order=DESC#

    /*
    Take out next keyfield value from data account / table 33,
    where the sort order is inverse DESC C B A 3 2 1 and save value in #DATA[nx]# / $nx
    */

    More information:
  • #DATA#
  • Step in the table
  •   set 1488 0
    #DATA[variable] post=set#

    Sets the value to BLHTML $variables.

    #DATA[variable] post=set# works with #IF# (Example on set in en #IF#).
    NOTE that this function does not work in other functions.

    Example to allocate values:
    #DATA[str] post=set value="This is a string"# // Allocates str="This is a string"

    Example to unset $variables:
    #DATA[str] post=set#
    #DATA[str] post=set value=NULL#

    Example to integrate strings:
    #DATA[str_one] post=set value="this is an test string"#
    #DATA[str_two] post=set value="that show blhtml=on/off"#

    #DATA[str_tree] post=set value="Here stings merge to one: #DATA[str_one]# #DATA[str_two]#"#

    #DATA[str_tree]#<br>
    #DATA[str_tree] blhtml=on#

    Returns:
    Here stings merge to one: #DATA[str_one]# #DATA[str_two]#
    Here stings merge to one: this is an test string that show blhtml on/off

    By default #DATA# dosen't get BLHTML executed.
    To BLHTML execute #DATA value# you need set blhtml=on.
    The code will be faster if blhtml=off only set blhtml=on when it's necessary.

    More information:
  • BLHTML syntax
  • #DATA#
  • operator
  • #SUM#
  •   show 1238 0
    #DATA[variable] post=show#

    By default is post=show and therefore not required. #DATA[variable]# Return value $variable to datapage.

    Example to write data:
    #DATA[variable]#
    // Shows contents in #DATA[variable]# as text

    Example return data to funktion:
    #READ value(#DATA[variable]#) blhtml=on# // better is #READ value=$variable#
    // Read post where keyfield is equal to #DATA[variable]# / $variable

    Example to set value on a variable if it's not declared:
    #DATA[variable] value(This variable is not set)#

    /*
    If #DATA[variable]# is not declared and no standardvalue from the table, then #DATA[variable]# becomes allocatedatt with: "This variable is not set" and print out value.
    If #DATA[variable]# shall be declared then post=set shall be used!
    */

    Manage array in a string:
    #DATA[string[+]] post=set value(this is 'an string' 'with many word')#

    #DATA[no] post=set value=3#

    This is the string array[+] = "#DATA[string[+]]#"<br>
    array 2: #DATA[string[2]]#<br>
    array #DATA[no]#:<br>
    #DATA(string[#DATA[no]#]) blhtml=all#<br>
    #DATA[string[$no]]#<br>
    #$string[$no]#
    // You can if you MUST!
    // How to access an element from #DATA#
    // Prefered way to access a array element

    Returns:
    This is the string array[+] = "this is 'an string' 'with many word'"
    array 2: an string
    array 3:
    with many word
    with many word
    with many word

    Strings is 0 litrerade (first string has index 0).

    Catch a array:
    #DATA[array[+]] post=set value(1 2 3 4 5 6)#
    #DATA[array[3]] return=tree#

    tree=#DATA[tree]#

    Returns:
    tree=4

    More information:
  • #DATA#
  • array
  •   new 2625 0
    #DATA[variable] post=new#

    #DATA[variable] post new# Create a html input element for editing variable. If value is stored in the data account table as a string (str) then object be a <input>. If it's a text or that cols is more than 1 then a <textarea> is created.

    Attributes associated with post=new:
    attributes:  contents:  description:
    valueTo set fixed value
    If no value, then value is contents of the variable
    typetexthtml <input> type
    readonly<input> field can only showing data
    maxlengthMax amount characters <input> can contain
    classCSS class on object
    bittype=checkbox can use one bit
    colsThe width on object
    rowsThe height on <textarea>
    sizecolsThe width on <input> field
    inkThe textcolor for the object
    paperThe papercolor for the object

    Example on creating editing field:
    #DATA[string] post=new rows=20 maxLength=12 class=tema#
    /*
            Create one editing field with max 12 characters for inputing into #DATA[str]#
            where the width is 20 characters and appearance is set with CSS style
    */


    #DATA[lockedfield] post=new readonly=true paper=FF00FF ink=FFFF00#
    // This field is read only (can not be changed) and have a pink background with yellow text

    #DATA[chbox] post=new prefix=id type=checkbox paper=FFFF00#
    /*
            prefix=id indicates that the element is part of a datalist and can be printed out with
            #ECHO# and the key for the table is id
            type=checkbox sets object to a checkbox
            Element's papercolor / background is painted with paper=FFFF00 (that is yellow).
    */

    Dropdown example:
    Dropdown exemple:
    #DATA[dropper1] post=new type=dropdown value=(this is an string 'with many word')#

    Returns:
    Dropdown exemple:


    More information:
  • Write to table
  • #DATA#
  • dropdown
  • #PLOPP#
  • set
  •   hidden 1107 0
    #DATA[variable] post=hidden#

    #DATA[variable] post=hidden# make <html> hidden of BLHTML variable, to send #DATA[variable]# to the next Forms.

    Two example on how variables can be sent with the form:

    Example 1:
    #DATA[i] post=set value(Some data)#
    // Assign #DATA[i]# / $i a string "Some data"
    #DATA[i] post=hidden#
    // Writes <html> hidden #DATA[i]# with current value "Some data"

    Example 2:
    #DATA[j] post=hidden value(A little more data)#
    // Dosen't assign #DATA[j]# / $j value, only writes the html hidden #DATA[j]# with string "A little more data"

    More information:
  • #DATA#
  •   next 1233 0
    #DATA[variable] post=next#

    #DATA[variable] post=next# gets the next post from a table. If not a next value then the first value is taken!

    values:    defaults:  description:
    idcurrent accountData account / table to be read from
    querykey fieldNext value from table: Key field
    whereprimary keyfield ASC  SQL-where expression

    Example:
    #DATA[nx] id=33 post=next query=n where(n order by DESC)#

    /*
    Take out next keyfield value from data account / table 33, where the sort order is inverse DESC C B A 3 2 1
    and save value in #DATA[nx]# / $nx
    */

    More information:
  • #DATA#
  • Step in the table
  • preview
  •   preview 1284 0
    #DATA[variable] post=preview#

    #DATA[variable] post=preview# gets the previous post from a table. If no previous value then the last value is taken!

    values:    defaults:  description:
    idcurrent accountData account / table to be read from
    querykey fieldPrevious value from table: Key field
    whereprimary keyfield ASC  SQL-where expression

    Example:
    #DATA[pw] post=preview#

    /*
    Take out previous keyfield value from the current account / table,
    where the sort order is ASC, 1 2 3 A B C and save value in #DATA[pw]# / $pw
    */

    More information:
  • #DATA#
  • Step in the table
  • next
  • BLHTML forum  


    apache MySQL PHP No to software patents! BLHTML
    © 2003, 2010 BLHTML
    This page is created with BLHTML in 0.1600 seconds