[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.--------------040302030606090003020704Content-Type: text/plain; charset=ISO-8859-1; format=flowedContent-Transfer-Encoding: 7bitHi,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 advanceLawrence '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 ); ?>--------------040302030606090003020704Content-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: 7bitHi,
I have never used [ArraySet] and [ArrayGet], I'm trying to understandit but it is a litlle obscure to me...
I have found a JQuery script that would save me a lot oftime,(
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 thefollowing code to some nice Webdna...
I have started with something looking like that :
[searchdb=../admin/clubs.db&neLIGUEdata=FINDALL®IONsumm=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:
This is a multi-part message in MIME format.--------------040302030606090003020704Content-Type: text/plain; charset=ISO-8859-1; format=flowedContent-Transfer-Encoding: 7bitHi,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 advanceLawrence '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 ); ?>--------------040302030606090003020704Content-Type: text/html; charset=ISO-8859-1Content-Transfer-Encoding: 7bitHi,
I have never used [ArraySet] and [ArrayGet], I'm trying to understandit but it is a litlle obscure to me...
I have found a JQuery script that would save me a lot oftime,(
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 thefollowing code to some nice Webdna...
I have started with something looking like that :
[searchdb=../admin/clubs.db&neLIGUEdata=FINDALL®IONsumm=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:
Some ThankYou page problems (1997)
select multiple 2 more cents (1997)
WebMerchant and AVS (1998)
[BULK] [WebDNA] A new commerce system for v7+ (2011)
[URGENT] Different Results From Math Tag Depending On OS (2006)
Listserver problem (1997)
GETCOOKIE not working as expected (2005)
session handling (2004)
Concatenating Form Variables (1998)
[WebDNA] Enable Email Authentication 7.1 OS x (2012)
Append probs, please help (2001)
shipcost (1997)
Recursion & WebDNA (1999)
Price Change (2000)
[AppendFile] problem (WebCat2b13 Mac .acgi) (1997)
Re[2]: webcat restarting script on Linux? (1999)
More on the email templates (1997)
WebCat2b13MacPlugin - nested [xxx] contexts (1997)
[delete] problem (1997)
Purchased cart being overwritten - still !?? (1997)