Keyword

Printing an Item

  • John R Orzell
  • John R Orzell's Avatar Topic Author
  • Offline
  • New Member
More
15 years 1 month ago #81607 by John R Orzell
Printing an Item was created by John R Orzell
Is there a way to stop/replace the site template css from the displaying in the print pop up window?
Attachments:

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81608 by Yiota
Replied by Yiota on topic Printing an Item
Check if on the print page you have a different body class than all other pages. If you do, use that body class to control the print page and overwrite the template's css.

It would be helpful if you could provide a link to your site.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81609 by DKcrm
Replied by DKcrm on topic Printing an Item
Hi - Can you explain more detailed how to check this?

I have the same problem on this page: interclub.dk/nyheder/klubben/item/123-krisestemning-i-inter-grund-til-bekymring-bedring-i-vente-eller-bare-prisen-for-cl-succes?
(When print is pressed, it fires up lightbox with clone of initial page)

- But on THIS page the print function works fine.... : interclub.dk/nyheder/kampreferater-og-andet/item/126-mourinho-har-sat-inter-op-til-barcelona
(When print is pressed, a printfriendly version of the article is loaded inside the lightbox)


Yiota Ziaggou said:Check if on the print page you have a different body class than all other pages. If you do, use that body class to control the print page and overwrite the template's css.
It would be helpful if you could provide a link to your site.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81610 by Yiota
Replied by Yiota on topic Printing an Item
On the loaded page on the lightbox the body has a class contentpane. With this class you can control the whole page and its css. As I noticed, on the page that works fine, the page doesn't load with any of the templates' css, which means that it doesn't inherit any of your templates' css.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81611 by DKcrm
Replied by DKcrm on topic Printing an Item
But why the difference when the articles have been created the same way?... :o)

How do I switch off the contentpane class when loading one page, when it's not loaded every time?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81612 by Yiota
Replied by Yiota on topic Printing an Item
The print page loads the k2.css so maybe you should make the appropriate changes there for this page.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81613 by DKcrm
Replied by DKcrm on topic Printing an Item
You're so clever... :o) - and fast!

I'll give it a try later and get back.. Thank you for now. :o)

Please Log in or Create an account to join the conversation.

  • John R Orzell
  • John R Orzell's Avatar Topic Author
  • Offline
  • New Member
More
15 years 1 month ago #81614 by John R Orzell
Replied by John R Orzell on topic Printing an Item
You are absolutely correct. I just changed to CSS background to #FFF for the contentpane and it worked. Thank you very much for your suggestion.

Yiota Ziaggou said:On the loaded page on the lightbox the body has a class contentpane. With this class you can control the whole page and its css. As I noticed, on the page that works fine, the page doesn't load with any of the templates' css, which means that it doesn't inherit any of your templates' css.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81615 by DKcrm
Replied by DKcrm on topic Printing an Item
Well, I'm very sorry to keep asking, but I can't seem to find out how to fix it...

In which file do I make the needed change? ks.css, modal.css or the default joomla template css? And what change should I make?

What's makes it more weird (to me at least) is that all k2 articles inherits their properties from the categories in which they're in - but articles within the same category seems to have this error..

Please help.... And again, I'm very sorry, but I'm not TOO experienced in locating these errors and fixing them out of my head.. :o)

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81616 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
This was a useful discussion! A great way to customize the styles,

But I have a question connected to this matter for which I can't find any information on this forum:

If I want to change the order of the different parts or for example show the absolute path to the print copy, what PHP file may I edit?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81617 by Yiota
Replied by Yiota on topic Printing an Item
@Christoffer Müller :
Edit the k2.css by targeting all information you want to be able to print, like title, text (introtext, fulltext), image, etc. and start by referring to them by body.contentpane .itemTitle, body.contentpane .introText, etc.
All other information you don't want to be at this page, like rating, simply add body.contentpane .itemRatingBlock {display:none;}.


@Mats Arvendal : What do you mean by "change the order of the different parts"?

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81618 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
Let's say I want to put the article parts itemTitle, author, introText etc in another order than the article displays on the webpage. I know how to customize the templates/views for the webpages, but how do I customize for the print function? Maybe I would like to add a script or a PHP code snippet. By what PHP files are the print page generated?

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81619 by Yiota
Replied by Yiota on topic Printing an Item
You can locate it inside your template override of k2, under "if($this->item->params->get('itemPrintButton')):" and on components/com_k2/models/item.php on line 67 there is the following statement.

//Print link
$item->printLink = urldecode(JRoute::_($link.'&tmpl=component&print=1'));

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81620 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
Thanks for all help. Sorry if I not fully understand how to create and apply a special template for prints. Do I alter this code in any way to invoke a "print-only" template? I suppose the JRoute command picks up the template used for the specific item. I would for example be able to add an absolute path and perhaps a quick print script in the printed text wndow.

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81621 by Yiota
Replied by Yiota on topic Printing an Item
Actually why go into so much trouble making a template for print by code and not simply use the CSS to create a totally different page? After all you do have an outer container to control all page. And with a simple display:none; to the elements you don't want to show and print you will spare a lot of time.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81622 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
Yeah, I may achieve most of my customizations via CSS, I have already stripped every item div that's not title, date, intro text and full text, but there are some more things I want to be able to do. Let's take an example, I want my printed page to contain this (from top to bottom):

1. A print button connected to a script to help people print without going to their browser's print tool
2. A simplfied website logo to identify the document (this may be solved via CSS)
3. An absolute path to the page (regardless of what the visitor has set in hers/his web browser print settings)
4. title
5. creation date
6. intro text
7. full text

In the template/view there's a different order, 5 comes above 4. So creation date and title will have to switch in the print. The actual website is serving both as an ordinary webstie and as an article archive where the output for the paper archive must look a certain way.

I hope you can make sense of this bewilderment.

Rgds

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81623 by Yiota
Replied by Yiota on topic Printing an Item
You can modify your item.php page override, by controlling what you want to show and where, by making this simple if control: if(JRequest::getCmd('print')==1). You can see this statement where the print button is. I'm afraid that only with this "if" you can set the print page as you want.

Now the print page is loaded through the the component.php page inside your template folder. If you want to edit anything for the print page you should edit that.

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81624 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
Great! This is what I was looking for.

Efharisto poli!

Please Log in or Create an account to join the conversation.

More
15 years 1 month ago #81625 by Mats Arvendal
Replied by Mats Arvendal on topic Printing an Item
Sorry, may I ask you to give me the paths to the files item.php and component.php? When I look in my html/k2/templates I find no component.php
Rgds

Please Log in or Create an account to join the conversation.

  • Yiota
  • Yiota's Avatar
  • Visitor
15 years 1 month ago #81626 by Yiota
Replied by Yiota on topic Printing an Item
Yes of course. The component.php is in templates/YOUR TEMPLATE/component.php and the item.php is in templates/YOUR TEMPLATE/html/com_k2/templates/default/item.php

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum