Keyword

Print link - make icon and duplication

  • Drazen
  • Drazen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #123636 by Drazen
Hi,

I need to insert icon instead print link "Print" in my Item view. Also I need to duplicate same link to bottom. Now is on the top.

Please explain me how to do it.

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123637 by Yiota
Replied by Yiota on topic Re: Print link - make icon and duplication
Hello,

To put an icon instead of a link all you have to do is some CSS styling but let's start with the duplicate first.
You will have to create a K2 template override in order to make this modification in item.php file. Read here on how the overrides work getk2.org/documentation/tutorials/174-templating-with-k2-and-the-concepts-of-sub-templates

Then locate this block of code and move it at the bottom where you want it as well.
<?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; ?>

Remove the <li> and </li> tags since you don't have a listing at the bottom.

Then all you need to do is css styling in order to show the icon instead of the text.
To hide the text you can write this

a.itemPrintLink span {display:none;}
and use the a.itemPrintLink to add as a background image your icon.

The styles can be put in your template's css file.

If you need more assistance on this maybe you should advise your template developer/provider first.

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

  • Drazen
  • Drazen's Avatar Topic Author
  • Offline
  • New Member
More
10 years 8 months ago #123638 by Drazen
Replied by Drazen on topic Re: Print link - make icon and duplication
Thank you Yiota Ziaggou,

I made it with this code

<?php if($this->item->params->get('itemPrintButton')): ?>
<!-- Print Button -->
<li>
<?php if(JRequest::getCmd('print')==1): ?>
<a class="itemPrintLink" href="<?php echo $this->item->printLink; ?>" onclick="window.print();return false;">
<span><img alt="printer" src="images/printer.png" height="50" width="50"); ?></span>
</a>
<?php else: ?>
<a class="modal itemPrintLink" href="<?php echo $this->item->printLink; ?>" rel="{handler:'iframe',size:{x:900,y:500}}">
<span><img alt="printer" src="images/printer.png" height="50" width="50"></span>
</a>
<?php endif; ?>
</li>
<?php endif; ?>

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

  • Yiota
  • Yiota's Avatar
  • Visitor
10 years 8 months ago #123639 by Yiota
Replied by Yiota on topic Re: Print link - make icon and duplication
You are welcome.

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


Powered by Kunena Forum