- Posts: 92
COMMUNITY FORUM
[SOLVED] Print View Override
- Mr_Anonymous
- Topic Author
- Offline
- Premium Member
Less
More
10 years 3 weeks ago #133578
by Mr_Anonymous
[SOLVED] Print View Override was created by Mr_Anonymous
How do you override the print view? Is my only option is to edit the "components/com_k2/css/k2.print" file directly? I tried creating an override like "templates/mytemplate/html/com_k2/css/k2.print" and I dont think that works for print view. Can someone confirm this please...
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 3 weeks ago #133579
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Print View Override
It depends on the browser if it respects the print styles.
I personally add a new media query (@media print) in my template's stylesheet.
I personally add a new media query (@media print) in my template's stylesheet.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Mr_Anonymous
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 92
10 years 3 weeks ago #133580
by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Print View Override
Thanks. I ended up using another solution for this. I added the print check condition directly with php like this to hide the sections that I dont want to come up in printing:
Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 3 weeks ago #133581
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Print View Override
Yes this will also work.
Keep in mind that you might need a CSS solution as well, since Joomla!'s print button the browser's print button have a different result.
Keep in mind that you might need a CSS solution as well, since Joomla!'s print button the browser's print button have a different result.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Mr_Anonymous
- Topic Author
- Offline
- Premium Member
Less
More
- Posts: 92
10 years 3 weeks ago #133582
by Mr_Anonymous
Replied by Mr_Anonymous on topic Re: Print View Override
Yeah you are right... When I printed the page as pdf I noticed the difference since the pop-up layout was different from actual printed layout. Thanks for pointing that out. :)
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 3 weeks ago #133583
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Re: Print View Override
You 're welcome :)
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Sori
- Offline
- Senior Member
Less
More
- Posts: 60
5 years 9 months ago #171091
by Sori
Replied by Sori on topic [SOLVED] Print View Override
Hi,
Would you please let me know which file is correspondent for the print view?
I want to make a very neat print view but right now everything is included in it like an article.
Thanks,
Sohrab
Would you please let me know which file is correspondent for the print view?
I want to make a very neat print view but right now everything is included in it like an article.
Thanks,
Sohrab
Please Log in or Create an account to join the conversation.
- Sori
- Offline
- Senior Member
Less
More
- Posts: 60
5 years 9 months ago #171093
by Sori
Replied by Sori on topic Re: Print View Override
Hi,
How? can you provide an example please?
How? can you provide an example please?
Please Log in or Create an account to join the conversation.
- JoomlaWorks
- Offline
- Admin
Less
More
- Posts: 6218
5 years 9 months ago #171116
by JoomlaWorks
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by JoomlaWorks on topic Re: Print View Override
The print view is a combination of the component.php subtemplate (it should exist inside /templates/YOUR_TEMPLATE/), the K2 template overrides and some CSS (k2.print.css - see my other post on how to override it - www.joomlaworks.net/forum/k2-en/37337-how-do-i-override-the-k2-print-css#132612).
The file component.php acts as a wrapper for the K2 template files (item.php to be exact).
Examine this page for example: demo.getk2.org/item?tmpl=component&print=1 (although we don't use any specific print styling here).
You can event create an entirely different section for the print view in K2's item.php by having a big if/else statement there. Shouldn't be too difficult to see how to do that as it exists already in item.php, for example here: github.com/getk2/k2/blob/master/components/com_k2/templates/default/item.php#L15
The file component.php acts as a wrapper for the K2 template files (item.php to be exact).
Examine this page for example: demo.getk2.org/item?tmpl=component&print=1 (although we don't use any specific print styling here).
You can event create an entirely different section for the print view in K2's item.php by having a big if/else statement there. Shouldn't be too difficult to see how to do that as it exists already in item.php, for example here: github.com/getk2/k2/blob/master/components/com_k2/templates/default/item.php#L15
Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Sori
- Offline
- Senior Member
Less
More
- Posts: 60
5 years 9 months ago #171262
by Sori
Replied by Sori on topic Re: Print View Override
I appreciate your reply.
I am studying them.
I am studying them.
Please Log in or Create an account to join the conversation.