Viper114 Posted January 10, 2011 Share Posted January 10, 2011 I'd like to know if PHP has some sort of "hide" method to use so that certain sections that don't need to be seen when you print a page can be hidden while printing.For example, on a section of our website, there is a menu on the right hand side that we have no need to see on the page when it's printed, so I was wondering if there's a PHP method of hiding these for printing, if such a thing exists. Link to comment Share on other sites More sharing options...
gar onn Posted January 10, 2011 Share Posted January 10, 2011 use an aditional page that doesn't show certain elements or/and use something like:<link rel="stylesheet" type="text/css" media="print" href="print.css" /> Link to comment Share on other sites More sharing options...
boen_robot Posted January 10, 2011 Share Posted January 10, 2011 ...and in the print.css, hide the elements you want hidden like (for example): #menu { display:none;} You can also embed the printing stylesheet in your normal stylesheet by adding this into your main CSS file: @media print { #menu { display:none; }} Link to comment Share on other sites More sharing options...
Viper114 Posted January 10, 2011 Author Share Posted January 10, 2011 Hmm, I suppose I could do that, too. I was focusing on changing the page in question to make the Print function of the browser make it neater, but having a new printer-friendly page would work, too. Link to comment Share on other sites More sharing options...
Viper114 Posted January 10, 2011 Author Share Posted January 10, 2011 That worked. I just made a new page with the necessary information needed for printing and made it printer friendly. So that's taken care of. Thanks! Link to comment Share on other sites More sharing options...
ShadowMage Posted January 10, 2011 Share Posted January 10, 2011 That worked. I just made a new page with the necessary information needed for printing and made it printer friendly. So that's taken care of. Thanks!You wouldn't even have to make a new page, just include those styles on the existing page. The media rules tell the browser how it should look when viewed in the browser and when it's printed. Link to comment Share on other sites More sharing options...
Dilated Posted January 10, 2011 Share Posted January 10, 2011 That worked. I just made a new page with the necessary information needed for printing and made it printer friendly. So that's taken care of. Thanks!ShadowMage is right, the whole point of the "print" media query is so that you don't have to create a new page. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.