Jump to content


Photo

PHP to HTML


  • Please log in to reply
5 replies to this topic

#1 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 May 2006 - 05:30 PM

Yo,

Guys, I need a little help here.. I'm lost in this problem.. The problem is:

[img src=\"style_emoticons/[#EMO_DIR#]/excl.gif\" style=\"vertical-align:middle\" emoid=\":excl:\" border=\"0\" alt=\"excl.gif\" /] I have a mail.php page, and it generate in the browser a page with the lastest news. But I want to send this one by mail, so I need to save this code as html so send it as newsletter.

[img src=\"style_emoticons/[#EMO_DIR#]/laugh.gif\" style=\"vertical-align:middle\" emoid=\":laugh:\" border=\"0\" alt=\"laugh.gif\" /] Thanks anyway,

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 18 May 2006 - 05:32 PM

You would generate the HTML the same as you would generate the page on your website, except that you put all the HTML code into a variable which gets passed on to the mail() call as the body.

Info: PHP Manual


#3 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 May 2006 - 05:43 PM

Hmm,

There's no other way? I need to save the mail.html because the sistem can create many files, so the user select the file to send.

If exist no other way, I'm thinking in create a html-generator, like htmlarea but more like then that blogs and flogs tools.. to designe how-to-show..

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)

#4 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 18 May 2006 - 05:45 PM

Well you would just create a file and write out to it then... I'm not sure why you'd want to do that, but that's up to you.

Info: PHP Manual


#5 alpine

alpine
  • Members
  • PipPipPip
  • Advanced Member
  • 756 posts
  • LocationNorway

Posted 18 May 2006 - 07:26 PM

I think i get your point, study and work on this:
<?php

// prepare to save a html version of news.php
// make sure you have a blank html page to duplicate from
$source_html_doc = "../newsletter/archive/blank.html";
$today = date(dmY);
$new_blank_html_doc = "../newsletter/archive/news_".$today."html";
copy($source_html_doc, $new_blank_html_doc)or die('Could not copy required file');

// start getting the generated contents of news.php
ob_start();
require("news.php");
$body_news = ob_get_contents();

// write a html version of it as archive
$html_change = fopen ($new_blank_html_doc, 'w');
fwrite ($html_change, $body_news);
fclose ($html_change);

// END ob_start
ob_end_clean();


// For use in HTML email body
$email_html_body = $body_news;

?>


#6 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 18 May 2006 - 07:58 PM

Yo,

Thats the point! I'm working on the script to see the result it does.. but, why I need a blank html page? May I create one? like using fopen ( html , w ) directly?

^-^! *scripting to see the result*

Yeah, safe and done! Its work perfectly.. I've change something and personalized it.. making a function.. =) thank you a lot!!

D.Soul
(If something is wrong, please tell me. I'm learning this language. Thank you)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users