discuss.answer
this is exactly, what dynamicDropdownTv is created for
Quote from: might-e at Dec 28, 2013, 01:19 AMWouldn't it be better to just use an API such as: http://www.geobytes.com/free-ajax-cities-jsonp-api.htm. I mean now you have to manually create a list of countries and all the cities? Using an API you have more flexibility.
Erwin,
thanks for idea!
In this particular case I need city names in Russian.
Quote from: Bruno17 at Dec 27, 2013, 09:21 PMthis is exactly, what dynamicDropdownTv is created for
Bruno, I got dynamicDropdownTv working.
Thank you!
But what if I have more than hundred countries and about few thousands of their cities...
I just imagine document tree for that.
I would prefer to have all the information in files or may be chunks or as TV values.
Can you please point me in the right direction? From where can I start?
Thank you again!
I would put them into Custom - Tables, one for Countries and one for Cities.
dynamicDropdownTv can also work with them the same way as it does with Recources/Subresources.
Custom tables?
Like these:
http://bobsguides.com/custom-db-tables.html
http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/using-custom-database-tables-in-your-3rd-party-components
?
I will try to.
Thank you!
UPD:
Will it be ok just to create manually custom tables in database and work with their data via xPDO?
Like this:
<?php
define('MODX_CORE_PATH', '/path/to/revo/core/');
define('MODX_CONFIG_KEY','config');
require_once MODX_CORE_PATH . 'model/modx/modx.class.php';
// Criteria for foreign Database
$host = 'localhost';
$username = 'your_username';
$password = 'your_password';
$dbname = 'your_database';
$port = 3306;
$charset = 'utf-8';
$dsn = "mysql:host=$host;dbname=$dbname;port=$port;charset=$charset";
$xpdo = new xPDO($dsn, $username, $password);
// Test your connection
echo $o = ($xpdo->connect()) ? 'Connected' : 'Not Connected';
// Issue queries against the foreign database:
$results = $xpdo->query("SELECT id FROM some_table");
.....
etc.
?
http://rtfm.modx.com/xpdo/2.x/getting-started/using-your-xpdo-model/database-connections-and-xpdo
[ed. note: mixa_ru last edited this post 10 years, 10 months ago.]
Hi,
We have tried to use @EVAL, @CHUNK, and @FILE in order to generate the TV options for a DynamicDropdownTV Child, however, we can not get this to work. Is it possible to use these bindings with this input type?