[WebDNA] Array for Dummies

This WebDNA talk-list message is from

2010


It keeps the original formatting.
numero = 104546
interpreted = N
texte = This is a multi-part message in MIME format. --------------040302030606090003020704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I have never used [ArraySet] and [ArrayGet], I'm trying to understand it but it is a litlle obscure to me... 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 that : [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 ); ?> --------------040302030606090003020704 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi,

I have never used [ArraySet] and [ArrayGet], I'm trying to understand it but it is a litlle obscure to me...
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 that :
[search db=../admin/clubs.db&neLIGUEdata=FINDALL&REGIONsumm=t]
[arrayset name=region&dim=2,[numfound]]
[founditems]([SKU])=[region]
[/founditems][/arrayset]
[/search]


Thanks in advance
Lawrence
<?php
$array = array();
if ($_GET['_name'] == 'country')
{
         if ( $_GET['_value'] == 3 )//usa
         {
                $array[] = array('1' => '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 );
?>

--------------040302030606090003020704-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Array for Dummies [solved] (Govinda 2010)
  2. Re: [WebDNA] Array for Dummies [solved] (Dan Strong 2010)
  3. Re: [WebDNA] Array for Dummies [solved] (Lawrence 2010)
  4. Re: [WebDNA] Array for Dummies (Lawrence 2010)
  5. Re: [WebDNA] Array for Dummies (Toby Cox 2010)
  6. Re: [WebDNA] Array for Dummies (christophe.billiottet@webdna.us 2010)
  7. Re: [WebDNA] Array for Dummies (Toby Cox 2010)
  8. Fwd: [WebDNA] Array for Dummies (Lawrence Banahan 2010)
  9. [WebDNA] Array for Dummies (Lawrence 2010)
This is a multi-part message in MIME format. --------------040302030606090003020704 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I have never used [ArraySet] and [ArrayGet], I'm trying to understand it but it is a litlle obscure to me... 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 that : [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 ); ?> --------------040302030606090003020704 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi,

I have never used [ArraySet] and [ArrayGet], I'm trying to understand it but it is a litlle obscure to me...
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 that :
[search db=../admin/clubs.db&neLIGUEdata=FINDALL&REGIONsumm=t]
[arrayset name=region&dim=2,[numfound]]
[founditems]([SKU])=[region]
[/founditems][/arrayset]
[/search]


Thanks in advance
Lawrence
<?php
$array = array();
if ($_GET['_name'] == 'country')
{
         if ( $_GET['_value'] == 3 )//usa
         {
                $array[] = array('1' => '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 );
?>

--------------040302030606090003020704-- Lawrence

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:

SmithMicro Help! -- Can't access WebCatalog Admin! (2001) WebDelivery (1998) I'm new be kind (1997) [OT] - Credit card processing company fees (2004) [URL] around a [sendmail] recipient? (2000) Pricing (1998) word count in HTML form textarea and linebreaks (2000) [WebDNA] WebDNA as cgi app (was WebSite Examples) (2008) Encryption Webdna method versus Cybercash (2005) WebCatalog2 Feature Feedback (1996) HomePage Caution (1997) instant cookies? (1999) list cookies and list http headers (1997) Execute Applescript (1997) Sort Order on a page search (1997) Append User DB? (2000) SQL (2003) Template not completely processed (1998) New Plug-in and Type 11 errors (1997) blank page from template (1997)