Jump to content

'fwrite()' Questions


techiefreak05

Recommended Posts

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 eg
the 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 like
put fread stuff in this scriipt
[code]
<?php
eval($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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 eg
the 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 like
put fread stuff in this scriipt
[code]
<?php
include($page); // the above page
echo $body;
?>
[/code]
and th pag which writes uses fwrite like this
[code]
$txt = "new"
fwrite($file, "<?php \n \$body=\"\$body $txt\"; \n ?>");
[/code]
Link to comment
Share on other sites

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


Link to comment
Share on other sites

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.