Quote from: tmcleroy at May 19, 2010, 12:14 PM
I am using GetField in a Jquery Tab. If the resource is published everything works fine. If the resource is unpublished the GetField snippet does not return a value. Is there anyway to get a value from an unpublished resource/document using Getfield?
<div id="tabs">
<ul>
<li><a href="#tabs-1">[[GetField? &docid=`67` &field=`pagetitle` ]]</a></li>
<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
<li><a href="#tabs-4">Contact Information</a></li>
</ul>
<div id="tabs-1">
<p> [!DynContent?docid=`67`!]</p>
</div>
In the above code DynContent snippet works for both the published and unpublished state of the document. GetField is working only for the document while is is published.
Thank you for any help on this.
there is no option in getfield to do upubed, but you could add this by altering this line:
while (($gfArrParent = $modx->getDocument($gfIntDocId,’parent’)) && ($gfArrParent[’parent’] != 0)
to:
while (($gfArrParent = $modx->getDocument($gfIntDocId,’parent’,0)) && ($gfArrParent[’parent’] != 0) || ($gfArrParent = $modx->getDocument($gfIntDocId,’parent’,1)) && ($gfArrParent[’parent’] != 0))
)
I did not test it but the case is that $modx->getDocument has the option to get unpubed or published docs
maybe you also need to to similar edit to the $modx->getTemplateVarOutput part if you need to use tv’s that are in docs that are unpublished
the 3th option is the pubbed (1) or unpubed (0) option