RE: [WebDNA] PHP Array translated to Webdna

This WebDNA talk-list message is from

2010


It keeps the original formatting.
numero = 104595
interpreted = N
texte = This is a multi-part message in MIME format. ------=_NextPart_000_0258_01CA9E5D.89509FF0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit This is actually very simple to do. Just change two lines in the JavaScript $('#country').chainSelect('#state','/examples/jquerycombo/combobox.php', $('#state').chainSelect('#city','/examples/jquerycombo/combobox.php', Change the path and the file combobox.php to a .tpl page on your server. Here is a template for you to use below. Just use a new case statement for each new country/list of cities and follow the pattern. Don't forget you still need two more JavaScript files that need to be linked in your page. The author includes them in his zip file. Good luck! [function name=run] -- code for country [showif [_id]=country] [switch value=[_value]] [case value=3] [return][{"1":"New York"},{"2":"Montana"},{"3":"Texas"},{"4":"Hawaii"}][/return] [/case] [default] [return][["No state"]][/case] [/default] [/switch] [/showif] -- code for state [showif [_id]=state] [switch value=[_value]] [case value=4] [return][{"1":"Honolulu"},{"2":"Hilo"},{"3":"Lahaina"},{"4":"Kona"}][/return ] [/case] [default] [return][["No city"]][/case] [/default] [/switch] [/showif] [return][/return] [/function][run] From: Lawrence [mailto:lawrence@authorsimage.com] Sent: Tuesday, January 26, 2010 1:17 AM To: talk@webdna.us Subject: [WebDNA] PHP Array translated to Webdna Hi, Can anyone help me with this. I have found a JQuery script that would save me a lot of time,(http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/ ) but it is linked to a PHP file. I'm trying to create my own TPL file. If there is a PHP Guru who could help me understand how to convert the following code to some nice Webdna... I have started with something looking like the following, but I'm not sure I'm going the right direction. [search db=../admin/clubs.db&neLIGUEdata=FINDALL®IONsumm=t] [arrayset name=region&dim=2,[numfound]] [founditems]([SKU])=[region] [/founditems][/arrayset] [/search] Thanks in advance Lawrence 'Montana'); $array[] = array('2' => 'New York'); $array[] = array('3' => 'Texas'); } else { $array[] = array('0' => 'No state'); } } elseif ($_GET['_name'] == 'state') { if ( $_GET['_value'] == 2 )//New York { $array[] = array('1' => 'New York'); $array[] = array('2' => 'Another city'); } else { $array[] = array('0' => 'No city'); } } else { $array[] = array('1' => 'Data 1'); $array[] = array('2' => 'Data 2'); $array[] = array('3' => 'Data 3'); } echo json_encode( $array ); ?> ------=_NextPart_000_0258_01CA9E5D.89509FF0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

This is actually very simple to do. Just change two = lines in the JavaScript

 
$('#country').chainSelect('#state','/examples/jquerycombo/combobox.php',

 

$('#state').chainSelect('#city','/examples/jquerycombo/combobox.php',

 

Change the path and the file combobox.php to a .tpl page = on your server. Here is a template for you to use below. Just use a new case = statement for each new country/list of cities and follow the pattern. Don’t = forget you still need two more JavaScript files that need to be linked in your = page. The author includes them in his zip file.


Good luck!

 

 

[function name=3Drun]

 

-- code for country

[showif [_id]=3Dcountry]

[switch = value=3D[_value]]

[case = value=3D3]

[return][{"1":"New York"},{"2":"Montana"},{"3":"Texa= s"},{"4":"Hawaii"}][/return]

[/case]

[default]

[return][["No state"]][/case]

[/default]

[/switch]

[/showif]

 

-- code for state

[showif [_id]=3Dstate]

[switch = value=3D[_value]]

[case = value=3D4]

[return][{"1"= :"Honolulu"},{"2":"Hilo"},{"3":&q= uot;Lahaina"},{"4":"Kona"}][/return]<= /span>

[/case]

[default]

[return][["No city"]][/case]

[/default]

[/switch]

[/showif]

 

[return][/return]

[/function][run]

 

From: Lawrence [mailto:lawrence@authorsimage.com]
Sent: Tuesday, January 26, 2010 1:17 AM
To: talk@webdna.us
Subject: [WebDNA] PHP Array translated to = Webdna

 

Hi,

Can anyone help me with this.

I have found a JQuery script that would save me a lot of time,(http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQu= ery/) but it is linked to a PHP file.
I'm trying to create my own TPL file.
If there is a PHP Guru who could help me understand how to convert the following code to some nice Webdna...
I have started with something looking like the following, but I'm not = sure I'm going the right direction.

    [search db=3D../admin/clubs.db&neLIGUEdata=3DFINDALL&REGIONsumm=3Dt]
    [arrayset name=3Dregion&dim=3D2,[numfound]]
    [founditems]([SKU])=3D[region]
    [/founditems][/arrayset]
    [/search]



Thanks in advance
Lawrence

    <?php
    $array =3D array();
    if ($_GET['_name'] =3D=3D 'country')
    {
             = if ( $_GET['_value'] =3D=3D 3 )//usa
             = {
            &= nbsp;       $array[] =3D array('1' =3D> 'Montana');
            &= nbsp;       $array[] =3D array('2' =3D> 'New York');   
            &= nbsp;       $array[] =3D array('3' =3D> 'Texas');     =  
            &= nbsp; } else
            &= nbsp; {
            &= nbsp;       $array[] =3D array('0' =3D> 'No state');
            &= nbsp; }
    } elseif ($_GET['_name'] =3D=3D 'state')
    {
             = if ( $_GET['_value'] =3D=3D 2 )//New York
             = {
            &= nbsp;       $array[] =3D array('1' =3D> 'New York');
            &= nbsp;       $array[] =3D array('2' =3D> 'Another = city');       
            &= nbsp; } else
            &= nbsp; {
            &= nbsp;       $array[] =3D array('0' =3D> 'No city');
            }
    } else
    {
            = $array[] =3D array('1' =3D> 'Data 1');
            = $array[] =3D array('2' =3D> 'Data 2');     
            = $array[] =3D array('3' =3D> 'Data 3');     
    }
    echo json_encode( $array );
    ?>

------=_NextPart_000_0258_01CA9E5D.89509FF0-- Associated Messages, from the most recent to the oldest:

    
  1. RE: [WebDNA] PHP Array translated to Webdna ("Olin Lagon" 2010)
  2. Re: [WebDNA] PHP Array translated to Webdna (Toby Cox 2010)
This is a multi-part message in MIME format. ------=_NextPart_000_0258_01CA9E5D.89509FF0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit This is actually very simple to do. Just change two lines in the JavaScript $('#country').chainSelect('#state','/examples/jquerycombo/combobox.php', $('#state').chainSelect('#city','/examples/jquerycombo/combobox.php', Change the path and the file combobox.php to a .tpl page on your server. Here is a template for you to use below. Just use a new case statement for each new country/list of cities and follow the pattern. Don't forget you still need two more JavaScript files that need to be linked in your page. The author includes them in his zip file. Good luck! [function name=run] -- code for country [showif [_id]=country] [switch value=[_value]] [case value=3] [return][{"1":"New York"},{"2":"Montana"},{"3":"Texas"},{"4":"Hawaii"}][/return] [/case] [default] [return][["No state"]][/case] [/default] [/switch] [/showif] -- code for state [showif [_id]=state] [switch value=[_value]] [case value=4] [return][{"1":"Honolulu"},{"2":"Hilo"},{"3":"Lahaina"},{"4":"Kona"}][/return ] [/case] [default] [return][["No city"]][/case] [/default] [/switch] [/showif] [return][/return] [/function][run] From: Lawrence [mailto:lawrence@authorsimage.com] Sent: Tuesday, January 26, 2010 1:17 AM To: talk@webdna.us Subject: [WebDNA] PHP Array translated to Webdna Hi, Can anyone help me with this. I have found a JQuery script that would save me a lot of time,(http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQuery/ ) but it is linked to a PHP file. I'm trying to create my own TPL file. If there is a PHP Guru who could help me understand how to convert the following code to some nice Webdna... I have started with something looking like the following, but I'm not sure I'm going the right direction. [search db=../admin/clubs.db&neLIGUEdata=FINDALL®IONsumm=t] [arrayset name=region&dim=2,[numfound]] [founditems]([SKU])=[region] [/founditems][/arrayset] [/search] Thanks in advance Lawrence 'Montana'); $array[] = array('2' => 'New York'); $array[] = array('3' => 'Texas'); } else { $array[] = array('0' => 'No state'); } } elseif ($_GET['_name'] == 'state') { if ( $_GET['_value'] == 2 )//New York { $array[] = array('1' => 'New York'); $array[] = array('2' => 'Another city'); } else { $array[] = array('0' => 'No city'); } } else { $array[] = array('1' => 'Data 1'); $array[] = array('2' => 'Data 2'); $array[] = array('3' => 'Data 3'); } echo json_encode( $array ); ?> ------=_NextPart_000_0258_01CA9E5D.89509FF0 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable

This is actually very simple to do. Just change two = lines in the JavaScript

 
$('#country').chainSelect('#state','/examples/jquerycombo/combobox.php',

 

$('#state').chainSelect('#city','/examples/jquerycombo/combobox.php',

 

Change the path and the file combobox.php to a .tpl page = on your server. Here is a template for you to use below. Just use a new case = statement for each new country/list of cities and follow the pattern. Don’t = forget you still need two more JavaScript files that need to be linked in your = page. The author includes them in his zip file.


Good luck!

 

 

[function name=3Drun]

 

-- code for country

[showif [_id]=3Dcountry]

[switch = value=3D[_value]]

[case = value=3D3]

[return][{"1":"New York"},{"2":"Montana"},{"3":"Texa= s"},{"4":"Hawaii"}][/return]

[/case]

[default]

[return][["No state"]][/case]

[/default]

[/switch]

[/showif]

 

-- code for state

[showif [_id]=3Dstate]

[switch = value=3D[_value]]

[case = value=3D4]

[return][{"1"= :"Honolulu"},{"2":"Hilo"},{"3":&q= uot;Lahaina"},{"4":"Kona"}][/return]<= /span>

[/case]

[default]

[return][["No city"]][/case]

[/default]

[/switch]

[/showif]

 

[return][/return]

[/function][run]

 

From: Lawrence [mailto:lawrence@authorsimage.com]
Sent: Tuesday, January 26, 2010 1:17 AM
To: talk@webdna.us
Subject: [WebDNA] PHP Array translated to = Webdna

 

Hi,

Can anyone help me with this.

I have found a JQuery script that would save me a lot of time,(http://www.codeassembly.com/Simple-chained-combobox-plugin-for-jQu= ery/) but it is linked to a PHP file.
I'm trying to create my own TPL file.
If there is a PHP Guru who could help me understand how to convert the following code to some nice Webdna...
I have started with something looking like the following, but I'm not = sure I'm going the right direction.

    [search db=3D../admin/clubs.db&neLIGUEdata=3DFINDALL&REGIONsumm=3Dt]
    [arrayset name=3Dregion&dim=3D2,[numfound]]
    [founditems]([SKU])=3D[region]
    [/founditems][/arrayset]
    [/search]



Thanks in advance
Lawrence

    <?php
    $array =3D array();
    if ($_GET['_name'] =3D=3D 'country')
    {
             = if ( $_GET['_value'] =3D=3D 3 )//usa
             = {
            &= nbsp;       $array[] =3D array('1' =3D> 'Montana');
            &= nbsp;       $array[] =3D array('2' =3D> 'New York');   
            &= nbsp;       $array[] =3D array('3' =3D> 'Texas');     =  
            &= nbsp; } else
            &= nbsp; {
            &= nbsp;       $array[] =3D array('0' =3D> 'No state');
            &= nbsp; }
    } elseif ($_GET['_name'] =3D=3D 'state')
    {
             = if ( $_GET['_value'] =3D=3D 2 )//New York
             = {
            &= nbsp;       $array[] =3D array('1' =3D> 'New York');
            &= nbsp;       $array[] =3D array('2' =3D> 'Another = city');       
            &= nbsp; } else
            &= nbsp; {
            &= nbsp;       $array[] =3D array('0' =3D> 'No city');
            }
    } else
    {
            = $array[] =3D array('1' =3D> 'Data 1');
            = $array[] =3D array('2' =3D> 'Data 2');     
            = $array[] =3D array('3' =3D> 'Data 3');     
    }
    echo json_encode( $array );
    ?>

------=_NextPart_000_0258_01CA9E5D.89509FF0-- "Olin Lagon"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Re:FYI: Error message (1996) RE: Answer: WebDelivery downloads alias, not original ? (1997) lineitems context in sendmail context (1998) HELP WITH DATES (1997) Help name our technology! (1997) Mac/network guy - newsfeed (2004) WebCat2b12--[searchstring] bug (1997) Re:Change WebDNA-Talk Mail due to no digest for 1wk (1997) Shipping formula problem (1997) Logging purchases (1997) hyperlinking unique input strings on the fly when displaying in HTML (2000) Secure Server basic question... (1997) Some Questions (1997) WebCat2final1 crashes (1997) Protect (1997) Nested tags count question (1997) Thanks Grant (1997) problems with 2 tags (1997) Filemaker Pro and [convertchars] (2000) Busted at the Border (1998)