Jump to content

PHP Include Print Only (may need javascript)


member

Recommended Posts

Hi,

I am wondering if anyone can give me or knows a code which prints a certain part of a webpage either a PHP include bit or a certain part of a webpage. Is there a way, if so please let me know. The print button will be an image not a standard button (form).

Also, "Print Window" method won't work, because it will print the entire site.
Thank You .
Your help is most appreciated
Link to comment
Share on other sites

You can use an activex program called scriptx. It is free and you can tell your web page what to print and what not to just by putting it in a certain class or between <div> tags. I use it to print up mysql web reports so there is nothing on the page BUT the report.

http://www.meadroid.com/scriptx/freedep.asp

Ray
Link to comment
Share on other sites

Thanks, but the url don't work, tried another site: http://www.jibbering.com/accessibility/install-scriptx.html

Installed it, but all it says is "Scriptx 5.5 was successfully installed" and it is not on my program files or anything?

Where is it?, is it installed as part of a programme?

oh no it works!!
thanks
Link to comment
Share on other sites

It makes the most sense (to me) to have two separate stylesheets - one for media=screen, one for media=print.  The print CSS stylesheet simply uses 'display:none' for everything on your html page that you do not want sent to the printer.  That gives you printer-friendly pages with nothing more than one extra CSS file and uses the javascript window.print method

Need an example?  Look at www.digitalmidget.com/php_noob/comment.php and use the 'file>print preview' option in your browser to see what would be printed from any page (or go ahead and hit the 'print page' image/link) on that page.
Link to comment
Share on other sites

Problem I have always have is the page numbers show up on top and the site shows on the bottom when you print. I know the CLIENT can shut them off, but why make them do it. The scriptx app shuts them down automatically. I have had good luck with it but I am sure there are alot of different ways to do it.

Ray
Link to comment
Share on other sites

oh yeh Thanks AndyB!! u helped me a lot, for that random .txt loader thing, I appreciate that, hought i'd tell u while ur here.
U can see a test on: http://islamcentre.awardspace.com/test/test2.php (just a test, one file missing).

anyways wheres that craygo gone....
Link to comment
Share on other sites

ok thanks, tutorial will be helpful a lot, i newbie as i told u before, so it will take a lot of telling to get it throught my head.
an example could be on: http://www.fisabilillah.org/ scroll down and u should see a "HAdith" it has a green print button, don't mind something like that, but i think it will require me to give them an id for each quote, which won't help because there are thousands of quotes. Thanks again...
Link to comment
Share on other sites

  • 1 month later...
[quote author=member link=topic=108519.msg455796#msg455796 date=1161519675]
is there another way, such as using tags?

like this
------------------------------------------------
other content
<print this bit>
to be printed part
</print this bit>

other stuff on site
------------------------------------------------

thanks
[/quote]

[b]YES![/b], and very, very, simply. Use CSS to define what is shown when a page is seen on screen and what is seen when the page is printed. Reply #3 in this thread explains.
Link to comment
Share on other sites

  • 11 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.