<![CDATA[ TV dropdown list: select COUNTRY => get list of CITIES - My Forums]]> https://forums.modx.com/thread/?thread=88314 <![CDATA[TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-485973
MODX Revolution 2.2.10-pl (traditional)

I'm stuck with problem-

I have two TV for the template: COUNTRIES and CITIES.

How can I pull all cities names depending on COUNTRIES TV selection (dropdown list input type both)?

Another words- I choose country name and get all cities in there as a dropdown list in COUNTRIES TV.

Thank you for all the ideas and solutions!]]>
mixa_ru Dec 26, 2013, 08:51 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-485973
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-564486
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?]]>
pmacsdpt Mar 18, 2019, 07:39 PM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-564486
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486565 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]]>
mixa_ru Jan 06, 2014, 01:01 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486565
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486536 dynamicDropdownTv can also work with them the same way as it does with Recources/Subresources.]]> Bruno17 Jan 05, 2014, 01:02 PM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486536 <![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486529 Quote from: Bruno17 at Dec 27, 2013, 09:21 PM
this 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!
]]>
mixa_ru Jan 05, 2014, 11:44 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486529
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486081 Quote from: might-e at Dec 28, 2013, 01:19 AM
Wouldn'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.]]>
mixa_ru Dec 28, 2013, 04:03 PM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486081
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486046 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.]]> might-e Dec 28, 2013, 01:19 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities?page=2#dis-post-486046 <![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES (Best Answer)]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486025 Bruno17 Dec 27, 2013, 03:21 PM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486025 <![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486021 sottwell,

Yes, it's for back-end.
To use in the Manager.

I'm doing real-estate website. When add new real estate property you choose country first and then you get drop down list of cities of choosen country. Both listts as a TV dropdown.

Sorry I was not exact in my question.....]]>
mixa_ru Dec 27, 2013, 08:54 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486021
<![CDATA[Re: TV dropdown list: select COUNTRY => get list of CITIES]]> https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486020 sottwell Dec 27, 2013, 08:32 AM https://forums.modx.com/thread/88314/tv-dropdown-list-select-country-get-list-of-cities#dis-post-486020