We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Hi guys,

    This is for MODX Revolution.

    I am looking to see if we can dynamically populate TV *input options values* based on currently edited resource, and those values will also come from the resource tree based on the criteria defined.

    For example, in a multi author, multi blog setup, every blog has a different categories. One way is to setup different templates for the different blogs and use different TVs with static input option values.

    The other way is to determine the current parent (blog homepage), where user is creating/updating the post and populate the values from its children categories, possibly under a "Categories" container. eg.
     @SELECT pagetitle,id WHERE parent = __current blog homepage's category container id__ 


    Looking forward to what you guys have to say about this, and how to do it.
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 4172
      • 5,888 Posts
      I think you can use a resource-list-TV with @EVAL - binding in input-option-values.
      You can run a snippet with
      @EVAL return $modx->runSnippet('getCategoryParent',array('resourceId'=>$modx->resource->get('id')));


      Let this snippet return your CategoryParent.

      On new Resources may be you have $_REQUEST[’parent’], when you edit resource you have $modx->resource - object which you can use to get the infos you need.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!