A client wants a "print" button on the top right of every page, so that it pops up a new window with the content written presented in plain text for printing.
I have it working fine using the GetField snippet but there is a problem. Whenever the content has a snippet call, it doesn’t evaluate, but instead shows the text of the snippet.
Here is a step by step flow of what I’ve done.
1.
The page looks like this:
The part starting "Recent media statements" is actually generated by a custom Snippet called "media" (this is just an example, the problem exists for any Snippet call):
[!media? &action=`summary` &numarticles=`5` !]
2.
The "print" button code looks like this:
<a href="[~[!GetField? &docid=`[*id*]` &field=`id`!]~]#" onclick="popwindow(’[~178~]&pageId=[*id*]’, ’[*title*]’)">
<img src="_images/print.png" title="Print this page" alt="Print this page" /></a>
I’m basically passing the ID of the page through its address as a variable (
pageId) so that I can use it later on the pop up window.
3.
This is the body part of the pop up page template:
<body onLoad="window.print(); window.close();">
<h1>[!GetField? &docid=`[*pageId*]` &field=`pagetitle`!]</h1>
<div>[!GetField? &docid=`[*pageId*]` &field=`content`!]</div>
</body>
The GetField receives the "pageId" variable from the address and then gets the pate title, and content.
This is the output of the popup window:
As you can see, instead of the media statements appearing, the snippet call code is displayed.
Is there a better way of doing this that I’m missing?
For the record, I’m using MODx version 0.9.6.3
Thanks!
[UPDATE : see further down for "Contact Us" eform page issue]