How to change print anchor in News from text to image

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
Milhaus

How to change print anchor in News from text to image

Post by Milhaus »

Hi,

I recently managed to change text "Print" to image in News detail and think, this might be useful for someone, who doesn't know CMSMS API.

Firstly, you can see here what I mean:

Image

The steps:

Change:

Code: Select all

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

Code: Select all

<div id="NewsPostDetailPrintLink">
<a href="{$entry->printlink}"><img src="images/cms/printbutton.gif"></img></a>
</div>
in your News (detail) template file.

Next, change in your action.detail.php file:

Code: Select all

$onerow->printlink = $this->CreateLink($id, 'print', $returnid, $this->Lang('print'), $sendtoprint);
to:

Code: Select all

$onerow->printlink = $this->CreateLink($id, 'print', $returnid, $this->Lang('print'), $sendtoprint,'',true);
Then it should work. If there will be any problems, let me know. I also would like to know solution, which doesn't require modification of News...

Milhaus
xmas3
Forum Members
Forum Members
Posts: 41
Joined: Sat Jul 28, 2007 9:22 am
Location: Bratislava / Slovakia

Re: How to change print anchor in News from text to image

Post by xmas3 »

Maybe using CSS ?

#NewsPostDetailPrintLink a{
  display: block;   
  width: 40px;
  height: 40px;
  text-indent: -9999px;
  background: transparent url('images/icon_print.gif') left top no-repeat;
  overflow: hidden;}

Width and height are the same of the image size, the charecter Print anchor is made invisible by text-indent.
Other solutions to make it invisible:
color: transparent  -> Mozilla OK, not working in IE and Opera
font-size: 0px; -> Mozilla OK, a small underline in IE and not working in Opera



What do you think about that?

Ahoj, Miro
Last edited by xmas3 on Wed Oct 29, 2008 2:53 pm, edited 1 time in total.
User avatar
Lucaz
Forum Members
Forum Members
Posts: 66
Joined: Fri Dec 01, 2006 9:56 pm
Location: Netherlands

Re: How to change print anchor in News from text to image

Post by Lucaz »

Post Reply

Return to “Tips and Tricks”