You are seeing this very light version of the page, as you are using an outdated browser!

Onlinetools.org is done in XHTML 1.0 and supports CSS 2.0, please upgrade your browser if you want a better version of this site.

Thank you, please help us developers keep up with the industry rather than patching our code for outdated applications.

open or close right navigation

How to create editable web sites in PHP

 
written by:Christian Heilmann on 26.04.2002
Jump to page: 1  2  3  4  5  6  or read all on one page
 

The template with the script

Let's take this as a demotext:

mytext.txt

This is my cool content, I am a born copywriter.
            

Believe me!

This is our demo template.

mypage.php


<html>
<head></head>
<body bgcolor="#cccccc" text="#000000" link="#000000" alink="#000000" vlink="#000000">
<font face="verdana, arial, helvetica" size="2">

<?PHP
    $filelocation = "mytext.txt";
    if (!file_exists($filelocation)) {
    echo "Couldn't find datafile, please contact administrator!";
    }
    else {
    $newfile = fopen($filelocation,"r");
    $content = fread($newfile, filesize($filelocation));
    fclose($newfile);
    }
    $content = stripslashes($content);
    $content = htmlentities($content);
    $content = nl2br($content);
    echo $content;
?>
    
</font>
</body>
</html>

Now save both to your server and set the file attributes of the .txt file to 666, to allow script to manipulate it.

To see it in action, click here.

Now, what does all this mean?

more»
Table of contents:

Introduction, what is this about?
Separation is necessary
The template with the script
What the script does
Adding secured interactivity
Goodies and limits

Back to top

Powered by EasyCMS