Right. Have you changed any of the default NP TPl chunks? What does your full NewsPublisher tag look like?
I started from scratch and it now seems to be working.
I do wish I could get the snippet to work, though. Having to manually add ids is going to be problematic given the number involved (currently ~20) with more being added weekly.
Thank you, Bob.
In case it helps anyone else here's my NP call:
[[!NewsPublisher?
&show=`content`
&hidemenu=`1`
&initrte=`1`
&rtcontent=`1`
&whichEditor=`TinyMCE`
&parentIds=`3,4,20,8,5,22`
&parent=`2`
&aliastitle=`1`
&outertpl=`NewsPub Form`
&cssfile=`/css/global.css`
&published=`1`
]]
Todd
Now that it's working, you might try adding the snippet tag as the value of &parentIds. I would try with the tag cached (no exclamation point) unless you have more than one NP page.
The snippet I posted had serious problems. I just corrected it (I hope).
[ed. note: BobRay last edited this post 11 years, 9 months ago.]
I'm glad it's working for you, though I don't see why you need the getResources call. getParents should create the drop-down for you is you include the parent property:
&parentIds=`[[getParents? parent=`2`]]`
I tried that but it causes the blank page issue I mentioned earlier. I clearly do not understand the reason why.
[ed. note: todd.b last edited this post 11 years, 9 months ago.]
Todd
Quote from: todd.b at Dec 24, 2014, 03:07 PMI tried that but it causes the blank page issue I mentioned earlier. I clearly do not understand the reason why.
Have you tried it with the new code I posted today?
There's probably still something wrong with it. I haven't had a chance to test it.
OK, it still had a couple of fatal typos in it. Try this:
/* getParents snippet */
$parentId = $modx->getOption('parent', $scriptProperties, '');
$parentObj = $modx->getObject('modResource', $parentId);
if ($parentObj) {
$final = array();
$final[] = $parentId; /* Might not want this it includes
the parent id in the list */
$docs = $parentObj->getMany('Children');
foreach ($docs as $doc) {
$docId = (int) $doc->get('id');
if ($doc->get('isfolder') && ($docId != 33)) {
$final[] = $doc->get('id');
}
}
}
return implode(",", $final);