-
- 19 Posts
i have revo 2.6.2. how can i mass delete some info in TV field? i need to it not by id's, but in specified folder
[ed. note: trofey last edited this post 5 years, 6 months ago.]
-
- 1,154 Posts
For something like MIGX tv, that's in your database so you could delete it all there
-
- 1,154 Posts
do you know how to go into your hoster account? and go into cPanel? Then you would use phpMyAdmin to go into the db and find the fields
-
- 1,154 Posts
hmm ok what can we do...what's your goal, to wipe out the tv entirely? or just one column of data?
i think one possible fix would be to copy the tv and replace the column you don't want.
Why not give us some of your code to work with?
The tv normally would have several associated fields, and if you changed a field, the data would still be there but no longer associated with the tv or visible.
So like a list of home movies might contain [[+year]][[+actors]][[+score]] and if you removed [[+score]] and replaced it with a new one, [[+review]], then you could start fresh
Be careful and back up your code. Move slowly. This is how I learned to code and there is a lot of trial and error.
What I would do is copy the resource, copy the tv, copy the template as backup, and then change the tv call in the template so its exactly what you want. Remove/replace the appropriate elements of the tv until you've got what you want.
-
- 24,544 Posts
I'm not sure I understand your question.
Do you want to remove the TV altogether, make it not connected to certain resources but not others, or just make its value empty for some resources under one or more folders?
All of these can be done with a fairly simple utility snippet, but we'd need to know exactly what you want to do to help you.
-
- 1,154 Posts
Yes BobRay is right, tell us more about what you need to do. We can help you find the best way.
-
- 24,544 Posts
Here's utility snippet that should blank out the value of the specified TV for children of the specified parents (untested).
$tvId = 12; // This is the TV that will be emptied
$parents = '12,33,56'; // children of these parents will have the TV emptyied
$parents = explode(',', $parents);
foreach ($parents as $parentId) {
/* Get the children */
$docs = $modx->getCollection('modResource', array('parent' => $parent));
foreach ($docs as $doc) {
/* Get the modTempateVarResources for each child */
$docId = $doc->get('id');
$criteria = array(
'contentid' => $docId,
'tmplvarid' => $tvId,
}
$tvrs = $modx->getCollection('modTemplateVarResource', $criteria);
foreach ($tvrs as $tvr) {
/* Blank the value of the TV */
$tvr->set('value', '');
$tvr->save();
}
}
}
return "Finished";