Is there a way to print just a section of a page?

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
fiddler

Is there a way to print just a section of a page?

Post by fiddler »

I'm not sure if this is the correct board to post this question to, but here goes. I am using 1.10.2 "Casa Pilote" and am using the News Module to post obituaries to a funeral home website. Additionally, I am using the CG Feedback module so people can post condolences under the obits. Adding the {print} brings up the entire obit page for printing but the funeral director wants people to be able to print out the obits without the condolences. Is there some param I can use to only call up a section of that page and stop it from printing out the entire page? I've told the funeral director to either copy and paste the obit only into word or tell the printer to print one page only, but that isn't a satisfactory answer for him.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Is there a way to print just a section of a page?

Post by velden »

Extensions->CMSPrinting->Print Template (tab)

That gives you all control you need doens't it?
fiddler

Re: Is there a way to print just a section of a page?

Post by fiddler »

I'm not understanding how this can be altered to print only a section of the page, since the CG Feedback code is part of the template - here's the code:
{* set a canonical variable that can be used in the head section if process_whole_template is false in the config.php *}
{if isset($entry->canonical)}
{assign var='canonical' value=$entry->canonical}
{/if}

{if $entry->postdate}
<div id="NewsPostDetailDate">
{$entry->postdate|cms_date_format}
</div>
{/if}
<h3 id="NewsPostDetailTitle">{$entry->title|cms_escape:htmlall}</h3>

<hr id="NewsPostDetailHorizRule" />

<div id="NewsPostDetailContent">
{eval var=$entry->content}
</div>

{if $entry->extra}
<div id="NewsPostDetailExtra">
{$extra_label} {$entry->extra}
</div>
{/if}

<div id="NewsPostDetailPrintLink">
{$entry->printlink}
</div>


{if $return_url != ""}
<div id="NewsPostDetailReturnLink">{$return_url}</div>
{/if}

{if isset($entry->fields)}
{foreach from=$entry->fields item='field'}
<div class="NewsDetailField">
{if $field->type == 'file'}
{* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
<img src="{$entry->file_location}/{$field->value}"/>
{else}
{$field->name}:&nbsp;{eval var=$field->value}
{/if}
</div>
{/foreach}
{/if}
--------------------------------<br />
{print text="Print this page"}
<br />Share this.<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style "><center>
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
</center>
</div>
{literal}
<__script__ type="text/javascript" src="http://s7.addthis.com/js/250/addthis_wi ... >{/literal}
<!-- AddThis Button END --><br />
<br />
<table width="400px"<tbody><tr><td>
<h3>Condolences to the Family</h3>
{CGFeedback key1="News" key2=$entry->id action='summary'}
{CGFeedback key1="News" key2=$entry->id}
</td></tr></tbody></table>
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1976
Joined: Mon Jan 29, 2007 4:47 pm

Re: Is there a way to print just a section of a page?

Post by Jo Morg »

Not tested, but the way I see it your options would be to either remove the calls to CGFeedback from the News template to the main template, or maybe even better assign them an only use the respective assigned values if they exist on the main template.

Something like:

Code: Select all

{* News detail template *}
{CGFeedback key1="News" key2=$entry->id action='summary' assign='CGF_Summ'}
{CGFeedback key1="News" key2=$entry->id assign='CGF_Detail'}
and then:

Code: Select all

{* Main page template *}
{if isset($CGF_Summ)}
{$CGF_Summ}
{$CGF_Detail}
{/if}
Assuming you are not using the includetemplate template only the content should be printed.

HTH
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
fiddler

Re: Is there a way to print just a section of a page?

Post by fiddler »

Oh, I think I understand. I'll give it a shot and let you know how I make out.

Thanks.
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3497
Joined: Mon Nov 28, 2011 9:29 am

Re: Is there a way to print just a section of a page?

Post by velden »

And that about a quick and dirty way: remove the comments by hiding them via print media specific css?
Post Reply

Return to “The Lounge”