We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    It’s quite alright. I’m working on http://www.olson.bz too and tomorrow is the deadline. It’s nearly done now, and this is one of the only things I’m not happy with. I don’t want to leave something important in the client’s hands, i.e. if they forget to define the variable at the top of the tree, anx attempt to visit a child of that branch kicked out a nasty SQL error.

    I have found a solution which I think will make @inherit even more powerful in the future. The following @eval reads the template variable of the parent using grad’s powerful getField snippet (Thanks grad!) If the TV in the parent hasn’t been defined it assigns the current docId.

    @EVAL $output=$modx->runSnippet("getField",array("docid"=>$modx->documentObject[’parent’],"field"=>"SubBranchID"));
    if($output>1)return $output;else return $modx->documentObject[’id’];

    I’m anything but an expert when it comes to PHP so note the nasty of $output>1 statement, but it works and I’m happy smiley

    Thanks for all your help Dimmy!

    Taff
      Adrian Lawley: www.adrianlawley.com