I'm adding a dropdown menu field with a list of countries on a flexinode on one of my projects.
The list is so large, that it's a pain to add them one by one through the web interface. Or even more awkward to edit it so countries appear in alphabetical order...
I tried editing the database content for that field and found this there:
a:33:{i:1;s:9:"Argentina";i:2;s:7:"Bolivia";i:3;s:6:"Brasil";i:4;s:5:"Chile";i:5;s:8:"Colombia";i:6;s:10:"Costa Rica";i:7;s:4:"Cuba";i:8;s:18:"Dominican Republic";i:9;s:7:"Ecuador";i:10;s:11:"El Salvador";i:11;s:9:"Guatemala";i:12;s:8:"Honduras";i:13;s:6:"Panama";i:14;s:8:"Paraguay";i:15;s:4:"Peru";i:16;s:9:"Venezuela";i:17;s:7:"Guayana";i:18;s:6:"Belize";i:19;s:2:"UK";i:20;s:3:"USA";i:21;s:6:"Canada";i:22;s:5:"Spain";i:23;s:6:"France";i:24;s:5:"Haiti";i:25;s:7:"Jamaica";i:26;s:11:"Puerto Rico";i:27;s:5:"India";i:28;s:5:"China";i:29;s:4:"Mali";i:30;s:5:"Ghana";i:31;s:8:"Zimbabwe";i:32;s:8:"Other...";i:33;s:8:"Other...";}
Simple enough, a:33 is the number of entries; i:## is the index number of the entry; but what does the s:## stand for???
Also, if anyone has a better solution, please let me now...
Thanks
Comments
s:## is string length...
Just realized that s:## just tells the module how many characters the string has...
If anyone has a better suggestion for a dropdown list of countries in flexinode (or has put together the list already), please let me know... otherwise I'll continue to add a couple of countries a day ;-) and share the list here when I'm done by 2006 :-O
------
Con paciencia y calma,
sube un burro a una palma
------
Con paciencia y calma,
sube un burro a una palma
Relief 2.0 - http://www.relief20.com
Navidad Latina - http://www.navidadlatina.com
new field type
you could create a new field type. that lets you store your choices in a DB and just present a dropdown on thje form. see other contribuetd field types for examples.
re: new field type
Moshe,
Can you expand on this? A new flexinode field type? Or a Drupal field type? Where can we find other contributed field types?
Thanks,
-Jeff
--= Jeff Robbins | Lullabot | Do It With Drupal =--
Did You Solve This?
Hi, I'm looking for something similar, I need to have my users selecting a country and university (the list of universities will depend on the country selected, I will do this with some Javascript).
I know I could use the profile.module or maybe flexinode.module but I really would like having a table for this information, one table called "universities" and other called "countries" (I just need America countries and Spain), I think it's easier to manage and more efficient when I need to add one new record.
How could I create these table and make them accesible from Drupal so the users can select the information from their profile page in a dropdown list?
Regards!
Alexis Bellido - Ventanazul web solutions
Alexis Bellido
Need help with your next Drupal project?
how to?
I´m building a site for a local Portuguese, sort of, NGO that the main mission is to exibit "alternative" cinema.
So, I created a new content type using flexinode called "movie sheet".
In this content I´ve inserted:
Some of this could/should be made with a drop-down menu field.
The thing is, if every time I want to insert a new say ... Director .. I´ll have to edit the drop-down menu field in "movie sheet" to have it displayed in the menu ...
This is not very logical is it?
So my question is:
How can I create a new field type in flexinode module?
And, for the drop-down field, how can I make it show the options dynamic way. I think I want to create a drop-down menu that "grows" along the way ...
Does this make any sense?
obrigado
should be a new field type within flexnode
I would think someone could come up with a new fieldtype for flexnode. Something like "node list" that would list all the titles for a node type in a dropdown list.
In your case, under content type "movie sheet", you would add this node list field. Select the node type to select from, which would be "Director".
When you add a new movie sheet, there would be a dropdown list of Directors. When you add a new director, their name would appear in the dropdown list.
There could be an option for that field's display to either appear as a linked name (Director name, linked to director node), or actually grab all the info from that node type and display it inline in the movie sheet page.
Man, that would be useful. Could use it myself for attaching "location" node types to "courses". I haven't really dug into drupal development yet, but hope to try something like this.
J
Any progress on anything
Any progress on anything like this? Thanks.
Flexinode country list field database syntax
Hi Carlos
I was looking to do exactly the same as you. When I saw that you were planning to do it manually...I thought there must be some way to automate. ;-)
There was. A feature in Excel lets you count the characters in a cell string and output it as a number (=LEN(target cell)). I set out a column in Excel for each portion of the flexinode tags e.g.
i : 1 ; s : 11 : " Afghanistan " ;
Here the index number begins with 1. You can increment this for subsequent rows with a simple equation in the cell below (=A3+1), where A3 is your first cell above, you can increment the cells below by 1 very easily.
I then pasted in an ISO-based country list into the column reserved for countries and autofilled all columns downwards for all fields. Then export as a CVS tab delimited file and finally, in a text editor, find and replace all the tabs with nothing. Add the start and end tags and the total number of fields in the index.
I've given this description because some people might want to do something similar with other sets of variables.
Here is the complete list in flexinode format:
a:239:{i:1;s:11:"Afghanistan";i:2;s:7:"Albania";i:3;s:7:"Algeria";i:4;s:14:"American Samoa";i:5;s:7:"Andorra";i:6;s:6:"Angola";i:7;s:8:"Anguilla";i:8;s:10:"Antarctica";i:9;s:19:"Antigua and Barbuda";i:10;s:9:"Argentina";i:11;s:7:"Armenia";i:12;s:5:"Aruba";i:13;s:9:"Australia";i:14;s:7:"Austria";i:15;s:10:"Azerbaijan";i:16;s:7:"Bahamas";i:17;s:7:"Bahrain";i:18;s:10:"Bangladesh";i:19;s:8:"Barbados";i:20;s:7:"Belarus";i:21;s:7:"Belgium";i:22;s:6:"Belize";i:23;s:5:"Benin";i:24;s:7:"Bermuda";i:25;s:6:"Bhutan";i:26;s:7:"Bolivia";i:27;s:22:"Bosnia and Herzegovina";i:28;s:8:"Botswana";i:29;s:13:"Bouvet Island";i:30;s:6:"Brazil";i:31;s:30:"British Indian Ocean Territory";i:32;s:17:"Brunei Darussalam";i:33;s:8:"Bulgaria";i:34;s:12:"Burkina Faso";i:35;s:7:"Burundi";i:36;s:8:"Cambodia";i:37;s:8:"Cameroon";i:38;s:6:"Canada";i:39;s:10:"Cape Verde";i:40;s:14:"Cayman Islands";i:41;s:24:"Central African Republic";i:42;s:4:"Chad";i:43;s:5:"Chile";i:44;s:5:"China";i:45;s:16:"Christmas Island";i:46;s:23:"Cocos (Keeling) Islands";i:47;s:8:"Colombia";i:48;s:7:"Comoros";i:49;s:5:"Congo";i:50;s:37:"Congo, the Democratic Republic of the";i:51;s:12:"Cook Islands";i:52;s:10:"Costa Rica";i:53;s:13:"Cote D'Ivoire";i:54;s:7:"Croatia";i:55;s:4:"Cuba";i:56;s:6:"Cyprus";i:57;s:14:"Czech Republic";i:58;s:7:"Denmark";i:59;s:8:"Djibouti";i:60;s:8:"Dominica";i:61;s:18:"Dominican Republic";i:62;s:7:"Ecuador";i:63;s:5:"Egypt";i:64;s:11:"El Salvador";i:65;s:17:"Equatorial Guinea";i:66;s:7:"Eritrea";i:67;s:7:"Estonia";i:68;s:8:"Ethiopia";i:69;s:27:"Falkland Islands (Malvinas)";i:70;s:13:"Faroe Islands";i:71;s:4:"Fiji";i:72;s:7:"Finland";i:73;s:6:"France";i:74;s:13:"French Guiana";i:75;s:16:"French Polynesia";i:76;s:27:"French Southern Territories";i:77;s:5:"Gabon";i:78;s:6:"Gambia";i:79;s:7:"Georgia";i:80;s:7:"Germany";i:81;s:5:"Ghana";i:82;s:9:"Gibraltar";i:83;s:6:"Greece";i:84;s:9:"Greenland";i:85;s:7:"Grenada";i:86;s:10:"Guadeloupe";i:87;s:4:"Guam";i:88;s:9:"Guatemala";i:89;s:6:"Guinea";i:90;s:13:"Guinea-Bissau";i:91;s:6:"Guyana";i:92;s:5:"Haiti";i:93;s:33:"Heard Island and Mcdonald Islands";i:94;s:29:"Holy See (Vatican City State)";i:95;s:8:"Honduras";i:96;s:9:"Hong Kong";i:97;s:7:"Hungary";i:98;s:7:"Iceland";i:99;s:5:"India";i:100;s:9:"Indonesia";i:101;s:25:"Iran, Islamic Republic of";i:102;s:4:"Iraq";i:103;s:7:"Ireland";i:104;s:6:"Israel";i:105;s:5:"Italy";i:106;s:7:"Jamaica";i:107;s:5:"Japan";i:108;s:6:"Jordan";i:109;s:10:"Kazakhstan";i:110;s:5:"Kenya";i:111;s:8:"Kiribati";i:112;s:38:"Korea, Democratic People's Republic of";i:113;s:18:"Korea, Republic of";i:114;s:6:"Kuwait";i:115;s:10:"Kyrgyzstan";i:116;s:32:"Lao People's Democratic Republic";i:117;s:6:"Latvia";i:118;s:7:"Lebanon";i:119;s:7:"Lesotho";i:120;s:7:"Liberia";i:121;s:22:"Libyan Arab Jamahiriya";i:122;s:13:"Liechtenstein";i:123;s:9:"Lithuania";i:124;s:10:"Luxembourg";i:125;s:5:"Macao";i:126;s:9:"Macedonia";i:127;s:10:"Madagascar";i:128;s:6:"Malawi";i:129;s:8:"Malaysia";i:130;s:8:"Maldives";i:131;s:4:"Mali";i:132;s:5:"Malta";i:133;s:16:"Marshall Islands";i:134;s:10:"Martinique";i:135;s:10:"Mauritania";i:136;s:9:"Mauritius";i:137;s:7:"Mayotte";i:138;s:6:"Mexico";i:139;s:31:"Micronesia, Federated States of";i:140;s:20:"Moldova, Republic of";i:141;s:6:"Monaco";i:142;s:8:"Mongolia";i:143;s:10:"Montserrat";i:144;s:7:"Morocco";i:145;s:10:"Mozambique";i:146;s:7:"Myanmar";i:147;s:7:"Namibia";i:148;s:5:"Nauru";i:149;s:5:"Nepal";i:150;s:11:"Netherlands";i:151;s:20:"Netherlands Antilles";i:152;s:13:"New Caledonia";i:153;s:11:"New Zealand";i:154;s:9:"Nicaragua";i:155;s:5:"Niger";i:156;s:7:"Nigeria";i:157;s:4:"Niue";i:158;s:14:"Norfolk Island";i:159;s:24:"Northern Mariana Islands";i:160;s:6:"Norway";i:161;s:4:"Oman";i:162;s:8:"Pakistan";i:163;s:5:"Palau";i:164;s:31:"Palestinian Territory, Occupied";i:165;s:6:"Panama";i:166;s:16:"Papua New Guinea";i:167;s:8:"Paraguay";i:168;s:4:"Peru";i:169;s:11:"Philippines";i:170;s:8:"Pitcairn";i:171;s:6:"Poland";i:172;s:8:"Portugal";i:173;s:11:"Puerto Rico";i:174;s:5:"Qatar";i:175;s:7:"Reunion";i:176;s:7:"Romania";i:177;s:18:"Russian Federation";i:178;s:6:"Rwanda";i:179;s:12:"Saint Helena";i:180;s:21:"Saint Kitts and Nevis";i:181;s:11:"Saint Lucia";i:182;s:25:"Saint Pierre and Miquelon";i:183;s:32:"Saint Vincent and the Grenadines";i:184;s:5:"Samoa";i:185;s:10:"San Marino";i:186;s:21:"Sao Tome and Principe";i:187;s:12:"Saudi Arabia";i:188;s:7:"Senegal";i:189;s:21:"Serbia and Montenegro";i:190;s:10:"Seychelles";i:191;s:12:"Sierra Leone";i:192;s:9:"Singapore";i:193;s:8:"Slovakia";i:194;s:8:"Slovenia";i:195;s:15:"Solomon Islands";i:196;s:7:"Somalia";i:197;s:12:"South Africa";i:198;s:13:"South Georgia";i:199;s:5:"Spain";i:200;s:9:"Sri Lanka";i:201;s:5:"Sudan";i:202;s:8:"Suriname";i:203;s:22:"Svalbard and Jan Mayen";i:204;s:9:"Swaziland";i:205;s:6:"Sweden";i:206;s:11:"Switzerland";i:207;s:20:"Syrian Arab Republic";i:208;s:25:"Taiwan, Province of China";i:209;s:10:"Tajikistan";i:210;s:28:"Tanzania, United Republic of";i:211;s:8:"Thailand";i:212;s:11:"Timor-Leste";i:213;s:4:"Togo";i:214;s:7:"Tokelau";i:215;s:5:"Tonga";i:216;s:19:"Trinidad and Tobago";i:217;s:7:"Tunisia";i:218;s:6:"Turkey";i:219;s:12:"Turkmenistan";i:220;s:24:"Turks and Caicos Islands";i:221;s:6:"Tuvalu";i:222;s:6:"Uganda";i:223;s:7:"Ukraine";i:224;s:20:"United Arab Emirates";i:225;s:14:"United Kingdom";i:226;s:13:"United States";i:227;s:36:"United States Minor Outlying Islands";i:228;s:7:"Uruguay";i:229;s:10:"Uzbekistan";i:230;s:7:"Vanuatu";i:231;s:9:"Venezuela";i:232;s:8:"Viet Nam";i:233;s:23:"Virgin Islands, British";i:234;s:20:"Virgin Islands, U.s.";i:235;s:17:"Wallis and Futuna";i:236;s:14:"Western Sahara";i:237;s:5:"Yemen";i:238;s:6:"Zambia";i:239;s:8:"Zimbabwe";}
_____________________________________________________________________
WILBA ¦ what's it like to...?
Drupal Forum: It's impossible to give a clear answer to an unclear question!
Nice solution, I'll try it.
Nice solution, I'll try it.