Hey guys. tell me if it is possible to add data to the resource tree from the database table.To create a separate page and fill in the TV fields?
If you want to create a new resource for every row in your table, you have to write some code:
- Query the data in your database table.
- For every row, create a new MODX resource with
$modx->newObject('modResource');
- Set the resource fields like “parent”, “pagetitle”, “template”, etc. and save the resource.
- Set the TV values with
$new_resource->setTVValue('tv_name', 'tv_value');
Alternatively use the MODX resource/create
processor.
Maybe you could also use the extra ImportX. This extra creates new resources from a CSV file. So you have to export your database table to a CSV file first.
Maybe you could also use the data from your database table directly in your site without creating a resource for every entry.
You could take a look at MIGXdb for managing custom database tables in a CMP.
thank you. They gave me some ideas