techiefreak05 Posted August 1, 2006 Share Posted August 1, 2006 Hi, I'm using fwrite() to create an HTML page when a user successfully registers, is there anyway I can create the pages with pre=set HTML code in the page?? Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 1, 2006 Share Posted August 1, 2006 I don't know what you mean by 'pre-set' HTML code. If you mean HTML string, yes. Just put that HTML code in a string variable and write it.Ronald ;D Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted August 1, 2006 Author Share Posted August 1, 2006 Right now, when I create the page, it's empty but I want them page to already have a "template", and how would I go about doing that? Quote Link to comment Share on other sites More sharing options...
Chetan Posted August 1, 2006 Share Posted August 1, 2006 Simple create a php page which includes vars from another php page and evals and displays them displays them, and you write to the pag with vars for egthe first time you write to the page it looks like[code]$body="helo";[/code]second time[code]$body="helo";$body"$body world";[/code]and the pag which displays this would hav somehing likeput fread stuff in this scriipt[code]<?phpeval($code);echo $body;?>[/code]and th pag which writes uses fwrite like this[code]$txt = "new"fwrite($file, "\$body=\"\$body $txt\";");[/code]it is a bit complicated but i would hav used this if i had to Quote Link to comment Share on other sites More sharing options...
ronverdonk Posted August 1, 2006 Share Posted August 1, 2006 Make a template HTML file with, at the places that you want to insert stuff dynamically, some placeholder text, such as e.g. {name} or {private msg} or whatever.When you read the template into your storage, you dynamically replace these placeholders with the dynamic text you want (using str_replace or a regular expression). After that you write the output HTML file.Ronald ;D Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted August 1, 2006 Author Share Posted August 1, 2006 Um, yeah That kinda confuses me... sry :( Quote Link to comment Share on other sites More sharing options...
Chetan Posted August 1, 2006 Share Posted August 1, 2006 u see its not easy. you can ofcourse write to a simple text file and include it in a php page, like what one does in chat pags. the stuff is savd in a file which is shown in a stylish way.edit another way__________Simple create a php page which includes vars from another php page and evals and displays them displays them, and you write to the pag with vars for egthe first time you write to the page it looks like[code]<?php$body="helo";?>[/code]second time[code]<?php$body="helo";$body"$body world";?>[/code]and the pag which displays this would hav somehing likeput fread stuff in this scriipt[code]<?phpinclude($page); // the above pageecho $body;?>[/code]and th pag which writes uses fwrite like this[code]$txt = "new"fwrite($file, "<?php \n \$body=\"\$body $txt\"; \n ?>");[/code] Quote Link to comment Share on other sites More sharing options...
Ifa Posted August 1, 2006 Share Posted August 1, 2006 You want to create a html file with some html code in it? I hope that is what you are looking for...If you are, try this:[code=php:0]$html = file_get_contents("existing_html_file.html");$file = fopen("new_file.html", "w+");fwrite($file, $html);fclose($file);[/code]If you are not looking for this, please ignore me :D Quote Link to comment Share on other sites More sharing options...
techiefreak05 Posted August 1, 2006 Author Share Posted August 1, 2006 THANKS!! Its almost EXACTLY what im looking for!! OMG thank you!! :P Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.