add logo to page generated by the "print" button

Contact the Development Working Group here: http://groups.google.com/group/joomla-dev-general

This forum is now closed and archived.
jpoo
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu May 31, 2007 4:19 pm

add logo to page generated by the "print" button

Postby jpoo » Thu May 31, 2007 4:27 pm

How do you add a logo to the  page generated by the "print" button. I have searched through out the forums.
Sounds like a custom CSS is required. Are there better instructions? I absolutely love this product and thank Joomla Group for all their good work.

nealb
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Tue Nov 25, 2008 5:26 pm

Re: add logo to page generated by the

Postby nealb » Tue Nov 25, 2008 6:26 pm

Is there a way this can be done in Joomla 1.5? Aside from a logo, I'd like to add a copyright notice. It can't be too hard...I just don't know where to look. Any help would be most appreciated.

Thank you!
Neal Bowes
www.DailyDevos.org

nealb
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Tue Nov 25, 2008 5:26 pm

Re: add logo to page generated by the

Postby nealb » Wed Nov 26, 2008 3:27 pm

OK, here's one possibility, but it has a limitation...

You can control the style of the print document by creating template.css and placing it in templates/system/css.

In template.css, you can enter...

Code: Select all

body:before {
   content:url("http://www.path-to-your-logo.jpg");
}


Works great in Firefox...and almost every other browser except IE. ":before" won't be supported until IE8.

Meanwhile, I was looking at the query sting that calls the print page and noticed "print=1." It shouldn't be too hard to come up with an if statement based on print=1 that would echo the logo right before the main content. Only thing is, I'm new to Joomla...and sorta new to php, for that matter...and I don't know what file to edit. Anybody else know?

Thanks,
Neal Bowes
DailyDevos.org

nealb
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Tue Nov 25, 2008 5:26 pm

Re: add logo to page generated by the

Postby nealb » Wed Nov 26, 2008 3:50 pm

OK, here's what I did...and it works...and I didn't see anything else that it screwed up (bonus)!

In the file templates/system/component.php at around line 26 is the body tag.
After that line, I inserted the following code...

Code: Select all

<?php
if($_GET['print'] == "1")
{
    echo "<img src='http://www.path-to-your-logo.jpg'>";
}
?>


Even IE can handle this.

It stands to reason that you could put similar code right before the closing body tag and echo a copyright notice.

Again, I have no idea if this is messing up something else, but I think it's ok.

Have Fun.

Neal Bowes
DailyDevos.org

gunsta
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Mar 11, 2009 7:30 am

Re: add logo to page generated by the

Postby gunsta » Wed Mar 11, 2009 7:34 am

Hi ;)

Hmmm... try to use VidLogo it help me and i hope it help you :)

Good Luck 8)

boleroinc
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Wed Mar 25, 2009 11:31 pm

Re: add logo to page generated by the

Postby boleroinc » Thu Mar 26, 2009 4:28 am

nealb.. strange.. I tried that but it doesn't work here : shrug :

nealb
Joomla! Apprentice
Joomla! Apprentice
Posts: 17
Joined: Tue Nov 25, 2008 5:26 pm

Re: add logo to page generated by the

Postby nealb » Thu Mar 26, 2009 1:32 pm

Hi boleroinc,

I don't know why it wouldn't be working. What's it doing?
My usual mistake is having the wrong URL to the .jpg.
BTW, I'm using Joomla 1.5.9. idk if other versions have a different file structure.

HWI
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Tue Oct 20, 2009 4:43 pm

Re: add logo to page generated by the

Postby HWI » Tue Oct 20, 2009 6:01 pm

Following nealb's example (thanks a lot - saved my day!). I got around to get some control over the print page output.
I would like to hear if anyone know if the way of doing this through the component.php can generate unforeseen issues - as I did not see any at this point.

For others looking to modify the print page output I will share what I did below.
My intentions was:

PRIMARY
Get a logo in the print page
Get some text reflecting the domain the print was done from


SECONDARY

Get rid of pagination images/text in the print output window
Move the "print" icon to a better place in the print output window
Make the "print" icon more explanatory to users that they would need to click it once more to get the printing going.

WHAT YOU NEED FOR DUPLICATING THIS TASK:
1 logo (80x80 pixel) logo.gif
(placed in: yoursite.com/templates/rhuk_milkyway/images/ )

1 graphic (120w x 16h pixels) print.gif
with a color and the "click to print" text written on it text aligned to the right leaving space for the print icon image to the left.
(placed in: yoursite.com/templates/rhuk_milkyway/images/ )

ENVIRONMENT:
Joomla 1.5.14
template: rhuk_milkyway
SEF = ACEsef

FILE TO MODIFY:
yoursite.com/templates/rhuk_milkyway/component.php
(I used this instead of the one placed in yoursite.com/templates/system/component.php)

IMPORTANT NOTE:
My example is with a joomla article that have "pagination=on" and show "icon" for print (so if your "print button" is pure text there would be variation in how the below is done - but basic the same)

I am not a programmer so this is purely done with nealb's idea and with my knowledge of css. So no warranty on my side ;)

1
Navigate by FTP client or on your local machine to the folder:
yoursite.com/templates/rhuk_milkyway/
(or the template you use - if no component.php i present copy from the above folder and put in there)

2
Backup the component.php before editing

3
Open the file with a text tool like "Notepad" so no formatting is messing up the code.

4
Place/save your graphic (logo and the "click to print" graphic) in the folder:
yoursite.com/templates/rhuk_milkyway/images/

5
Start modify the component.php file around line 26 (just after : body class="contentpane" )

Insert the following code (Do not forget to edit all domain names - file names and folder names to what reflect your situation) :

Code: Select all

   <?php
if($_GET['print'] == "1")
{
    echo "<style type=\"text/css\">
    table.pagenav{display:none;}
    p.buttonheading{position:absolute;top:1px;right:0;}
    p.buttonheading a {background:url(http://www.YOURDOMAIN.COM/templates/rhuk_milkyway/images/print.gif) no-repeat top left;height:16px;width:120px;display:block;}
    </style>
   
    <div style=\"height:98px;width:100%;border:1px solid #b1b1b1; \">
   
    <div style=\"background:#7c7c7c;height:16px;width:100%;display:block;\"></div>
   
    <img style=\"float:left;\" src='http://www.YOURDOMAIN.COM/templates/rhuk_milkyway/images/logo.gif' />
   
    <h4 style=\"float:left;margin-left:50px;color:#b1b1b1;font-weight:normal;margin-top:45px;\">SITENAME GOES HERE :: www.DOMAINNAME.COM ::</h4>
</div> ";   
}
?>


6
Save the file - do not forget it need the extension .php after the filename - Go to your page and click print icon to see if it works
If no show check you domain- file- folder-names

Hope this helps someone - without any knowledge on php or css.
And again I would love to hear from someone if this could pose unforeseen issues.
You do not have the required permissions to view the files attached to this post.


Return to “Development”

Who is online

Users browsing this forum: No registered users and 2 guests