Very often you have to solve the standart tasks. MODx Evo / Revo db API can let us build our code fatser and safer.
The following php code returns the child resources ids of the parent doc in MODX Evolution:
- <?php
- $ret = '';
- $return = array();
- $table_name = $modx->getFullTableName( 'site_content' );
- $ChildResIds = $modx->db->select('id', $table_name , "parent = $parent");
- $Rows = $modx->db->getRecordCount( $ChildResIds );
- if($Rows > 0){
- while($row = $modx->db->getRow( $ChildResIds )){
- $return[] = $row['id'];
- }
- }
- $ret = implode(",", $return);
- return $ret;
- ?>
The following XPDO / php code returns the child resources ids of the parent doc in MODX Revolution:
- $resources = $modx->getCollection(“modResource”, array(“parent” => 3,“context_key” => “web”));
Rate this information:
Votes: 2101May we recommend:
taxi organisation website on modx evo Web-based inventory scan app psd to html and html to modx template Link pruning, Fix Crawl Errors
MODX CMS extensions Sale:
5h support MODX Evolution documents as products export to google base 3h support 6h support