We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24629
    • 370 Posts
    Hi i want a plugin that looks at the parent of a page and then puts the pagetitle of the parent in a tv, 'parentname'
    i undestand that i should do this onDocFormSave but how can i get the parents pagetitle an put it in the TV?

    Tnx
    RDG
      • 4172
      • 5,888 Posts
      something like this could do it:

      if ($resource){
          $docid = $resource->get('id');
          $parent = $resource->get('parent');
          if ($parent = $modx->getObject('modResource',$parent)){
              $resource->setTVValue('parentname',$parent->get('pagetitle'));
          }
      }
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!