<![CDATA[ Revo - Pull document content into a template without a tv? - My Forums]]> https://forums.modx.com/thread/?thread=16733 <![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv?page=2#dis-post-507114
For example, pdoMenu can be configured to not waste its time checking for permissions in the case of a site that doesn't use them.]]>
sottwell Aug 22, 2014, 11:10 PM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv?page=2#dis-post-507114
<![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv?page=2#dis-post-507107
Scenario: You want clients to be able to edit content in your templates site-wide, but you don't want them messing with your templates or chunks.

I first tried the @DOCUMENT TV approach and it had a couple of flaws.

1. It introduced TVs that the client shouldn't touch for fear of breaking them, and explaining why they could edit one TV and not another was going to be tricky.
2. It was a bugger to get it to work with lots of cache clearing and removing / reinstalling involved. Even then some of them would randomly and inexplicably refuse to display the content, instead just showing @DOCUMENT NN

If this sounds like you, grab the GetResourceField snippet and include the call to your resource in your templates. Works great.]]>
grogorio Aug 22, 2014, 09:36 PM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv?page=2#dis-post-507107
<![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90132 ]]> markh Dec 24, 2010, 12:39 PM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90132 <![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90131 basw Dec 24, 2010, 12:26 PM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90131 <![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90130
You can also make your own snippet if you want, may save some resourced compared to the getResources snippet.
$docid = 999; // Put the ID of the resource with the sidebar content here
$resource = $modx->getObject('modDocument', $docid);
return $resource->getContent();


Untested, but should work smiley


Oh and another option would be using the getResourceField snippet.]]>
markh Dec 23, 2010, 05:16 PM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90130
<![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90129

modx is quite fantastic, I am just not very bright]]>
lowelife Dec 20, 2010, 10:41 AM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90129
<![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90128 rethrash Dec 20, 2010, 10:34 AM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90128 <![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90127
For context:
My site has a sidebar that will contain a vertical stack of hyperlinked images. While I’m sure there are different ways for me to implement this for my clients, who are not HTML savvy, I have decided that while I am learning modx the easiest thing for me to do is have the content of the sidebar be contained in a document resource, which they can conceptually understand as a reusable/included element.

Right now, my template contains a TV that references the document using @DOCUMENT 11

My original question was whether I could just do the reference from the template, rather than from the TV, because I want to remove the clutter of TVs from the editing experience.

When I do as you suggest, put @DOCUMENT 11 directly in my template, it just outputs as text.

]]>
lowelife Dec 20, 2010, 10:16 AM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90127
<![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90126 rethrash Dec 18, 2010, 11:34 AM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90126 <![CDATA[Re: Revo - Pull document content into a template without a tv?]]> https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90125
Unfortunately [[@DOCUMENT 11]] doesn’t display the content.

Running:
MODx Revolution 2.0.5-pl (traditional)
On hosted Linux Apache]]>
lowelife Dec 18, 2010, 08:45 AM https://forums.modx.com/thread/16733/revo---pull-document-content-into-a-template-without-a-tv#dis-post-90125