For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > October 2005 > [PHP-DB] Email Article, Print Article









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author [PHP-DB] Email Article, Print Article
Tramelw@aol.com

2005-09-30, 6:56 pm

Hello,

I am running an article-based site, where I would like to add two buttons:
print this article and email this article.

Does anyone know where I could look to find out how to program this code
into my article.php page?


Thanks in advance,


Eddie Wonder

Bastien Koert

2005-09-30, 6:56 pm

Sure, not that hard...the usual trick with printing is to add this button

<input type='button' value='print' onclick='window.print();'>

To email it, I would add a button that has a link to the article (like the
id reference no) and then with the onlclick open a small window with the
form to add the email address(es). On submitting that little form, it pulls
the article from the storage and either embeds it or attaches it to an
email...depending on how you want to handle it...

Does that help?

Bastien



>From: Tramelw@aol.com
>To: php-db@lists.php.net
>Subject: [PHP-DB] Email Article, Print Article
>Date: Fri, 30 Sep 2005 13:50:37 EDT
>
>Hello,
>
>I am running an article-based site, where I would like to add two buttons:
>print this article and email this article.
>
>Does anyone know where I could look to find out how to program this code
>into my article.php page?
>
>
>Thanks in advance,
>
>
>Eddie Wonder

Micah Stevens

2005-09-30, 6:56 pm


No, but it's pretty straightforward, just have each link to another script
along with a get variable that defines which article (assuming they're in a
database or something)

email_article.php?article=$articleID
print_article.php?article=$articleID

email_article.php: (pseudo code)

<?php

// first get article from storage

// setup mail_mime session (Pear class)

// attach article to friendly email, or insert directly.

// send it

?>

print_article.php:

<?php

// get article from storage

// print it on screen without headers and stuff you don't want to print.

?>


Done..

-Micah


On Friday 30 September 2005 10:50 am, Tramelw@aol.com wrote:
> Hello,
>
> I am running an article-based site, where I would like to add two buttons:
> print this article and email this article.
>
> Does anyone know where I could look to find out how to program this code
> into my article.php page?
>
>
> Thanks in advance,
>
>
> Eddie Wonder

Tramelw@aol.com

2005-09-30, 6:56 pm

Thank you Bastian and Micah.

I had no idea the concept was so straightforward.

I guess I was close to making a mountain out of a molehill.


Thanks again,


E. Wonder


Leo G. Divinagracia III

2005-10-04, 3:55 am

Tramelw@aol.com wrote:

> Hello,
>
> I am running an article-based site, where I would like to add two buttons:
> print this article and email this article.
>
> Does anyone know where I could look to find out how to program this code
> into my article.php page?
>
>


anothing this is to use CSS to strip out all of the fancy tables and
graphics and stuff in the "printed" page option.

plus, i use this trick to read a site that separates the article into
multipages.

when you click on the PRINTED option, it dumps the whole article into a
graphics free format... ;)

--
Leo G. Divinagracia III
leo.divinagraciaiii@csueastbay.edu
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com