- Posts: 17
COMMUNITY FORUM
Print K2 category menu item
- Idar Aspmodal
-
Topic Author
- Offline
- New Member
Less
More
10 years 4 weeks ago #142997
by Idar Aspmodal
Print K2 category menu item was created by Idar Aspmodal
Hi,
When an menu item is set as an K2 article it is possible to add printing functionality in the top line, but I can't find this when showing an category.
How can I set it to be able to print category menu item?
When an menu item is set as an K2 article it is possible to add printing functionality in the top line, but I can't find this when showing an category.
How can I set it to be able to print category menu item?
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 4 weeks ago - 10 years 4 weeks ago #143002
by Krikor Boghossian
Replied by Krikor Boghossian on topic Print K2 category menu item
The print button is only part of the item.
You can override the category.php file and add the button (from item.php) there as well.
This post will help you with the overriding process getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
IMO i do not think this is necessary since everyone can use CTRL/CMD + P in order to print that view.
You can override the category.php file and add the button (from item.php) there as well.
This post will help you with the overriding process getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates
IMO i do not think this is necessary since everyone can use CTRL/CMD + P in order to print that view.
Last edit: 10 years 4 weeks ago by Krikor Boghossian.
Please Log in or Create an account to join the conversation.
- Idar Aspmodal
-
Topic Author
- Offline
- New Member
Less
More
- Posts: 17
10 years 4 weeks ago - 10 years 4 weeks ago #143005
by Idar Aspmodal
Replied by Idar Aspmodal on topic Print K2 category menu item
Hi,
I tried adding the K2 Plugins: K2AfterDisplayTitle from the item.php file, but get an error on line 41 in the attached file. May that be because there is no place to set the printing button to be visible?
Take a look here: 46.250.210.170/om/firmaet/programvare2
Oops, something went wrong with the attachment. Below you will find the code:
Before:
Printing code:
After:
Line 41 is:
I tried adding the K2 Plugins: K2AfterDisplayTitle from the item.php file, but get an error on line 41 in the attached file. May that be because there is no place to set the printing button to be visible?
Take a look here: 46.250.210.170/om/firmaet/programvare2
Oops, something went wrong with the attachment. Below you will find the code:
Before:
<?php if(isset($this->category) || ( $this->params->get('subCategories') && isset($this->subCategories) && count($this->subCategories) )): ?>
Printing code:
<!-- K2 Plugins: K2AfterDisplayTitle -->
<?php echo $this->item->event->K2AfterDisplayTitle; ?>
<?php if(
$this->item->params->get('itemPrintButton')): ?>
<div class="itemToolbar">
<ul>
<?php if($this->item->params->get('itemPrintButton') && !JRequest::getInt('print')): ?>
<!-- Print Button -->
<li>
<a class="itemPrintLink" rel="nofollow" href="<?php echo $this->item->printLink; ?>" onclick="window.open(this.href,'printWindow','width=900,height=600,location=no,menubar=no,resizable=yes,scrollbars=yes'); return false;">
<span><?php echo JText::_('K2_PRINT'); ?></span>
</a>
</li>
<?php endif; ?>
</ul>
<div class="clr"></div>
</div>
<?php endif; ?>
After:
<!-- Blocks for current category and subcategories -->
Line 41 is:
$this->item->params->get('itemPrintButton')): ?>
Last edit: 10 years 4 weeks ago by Idar Aspmodal.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
-
- Offline
- Platinum Member
Less
More
- Posts: 15920
10 years 4 weeks ago #143019
by Krikor Boghossian
Replied by Krikor Boghossian on topic Print K2 category menu item
Just this code will do
The rest are checks and statements which are invalid in the category view. You might need to tweak your CSS as well.
<a class="itemPrintLink" rel="nofollow" href="<?php echo $this->item->printLink; ?>" onclick="window.open(this.href,'printWindow','width=900,height=600,location=no,menubar=no,resizable=yes,scrollbars=yes'); return false;">
<span><?php echo JText::_('K2_PRINT'); ?></span>
</a>
The rest are checks and statements which are invalid in the category view. You might need to tweak your CSS as well.
Please Log in or Create an account to join the conversation.