We can print output from explorer print option. But has PHP built function that used to print? Specially, in a custom way, like, any part of it.
No this can only be done on the client side. PHP is a server side language. JavaScript is what you need.
PHP is a server side language and executes on the server, not on client. Do you want to amaze your datacenter workers? I think there is no printer there
Thanks LittleJOn, It shows it is your 50th post. Congrates!! for fifty. If I use Java Script along with PHP, is print possible?
Depends how you want to do it admins If you wish to print on the machine running PHP, then yes you can.
Er, well you would normally use PHP to generate a "clean" and printer-friendly page from your database (if your using one). You would then just need to do this: <a href="javascript:window.print();">Print</a> Sorry about double post, hit wrong button -.-
Yes, the above is correct. You can use google to find more detaild explanations but the following should work, (not tested) <a href="JavaScript:window.print();">Print this page</a> Code (markup): EDIT: Sorry, that above must have been posted when i was typing.
I would not recommend to make duplicate content for printer. Instead of it use CSS for printer-friendly page tuning. Just include another CSS and hide unwanted blocks: <link rel="stylesheet" type="text/css" href="print.css" media="print" /> HTML:
Thanks for your code. Say, I have many data in database, And say from different country. And I want to print them countrywise in seperate page. What should be done?
Thats a good method to use, but when your site has a lot of content, and maybe a variation of templates it may fail. Duplicate content is fine, such as the lofi version for some forums. It's easier too.
You choose. But having duplicate content can affect your SE rankings. For example Google can just prefer "printer-friendly" page and skip real page with ads etc.