I’d like to put a header in a subset of my documents based on the longtitle of the parent document. I’ve looked through the standard codes and searched the forums but can’t find anything ready-made that might do this. Any suggestions? I’m still a MODx and PHP newbie, so I need a bit of hand-holding.
-
MODX Staff
- 12,272 Posts
You’d need to create a quick snippet to do that. You might want to look at the GetField snippet for inspiration.
Ryan Thrash, MODX Co-Founder
Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
Not an expert myself but here goes
In your snippet:
$parentLongTitle = $modx->getParent($this->documentIdentifier,1,’longtitle’);
if($parentLongTitle == "long title 1"){
//do something. you might include a file include(myheader1.php)
}else{
//do something else
}
not tested
Use the getField snippet it can do exactly this.