Article
Content Management Made Easy - with Editize!
The Menu Selection Page
On the page generated by the code above, the user will be able to select the page they'd like to edit:

Editize Page
Upon making their selection the user will be presented with the Editize page, where they may easily edit and format their content using the built-in capabilities provided by the Editize applet.

The code for this content editing page is as follows:
<?php require('editize.php'); ?>
<?
if ($auth == "authorize") {
$msg = "<p>You may now perform updates</p>";
} else {
header("Location: http://localhost/login.htm");
exit;
}
mysql_connect('localhost','baggins','adventure');
mysql_select_db('content');
$sql_result = mysql_query("SELECT pagebody FROM
content WHERE id = 20");
$content = mysql_fetch_array($sql_result);
$pagecontent = $content["pagebody"];
?>
<HTML>
<HEAD>
<TITLE>Your Update Page</TITLE>
</HEAD>
<BODY>
<form name="form1" method="post" action="update.php">
// Note that the form submits the data to update.php
The following code loads the Editize applet, and
is used to replace the textarea tag. The applet
is also set here to initially display the old content
(stored in $pagecontent) which is to be updated.
<?php
$ed = new Editize;
$ed->name = 'pagecontent';
$ed->display("<p align=\"center\">$pagecontent</p>");
?>
<input type="submit" name="Submit" value="Update Record">
</form>
</BODY>
</HTML>
The Database Update Page
When the user finishes editing the content, they will submit the data. The form is submitted to the file update.phpm which updates the content database. Let's see how:
<?
if (!$pagecontent) {
header( "Location: http://localhost/folder/update.php");
exit;
}
$db_name = "content";
$table_name = "content";
$cnx = @mysql_connect("localhost", "bilbo", "adventure")
or die("Couldn't connect.");
$db = @mysql_select_db($db_name, $cnx) or die("Couldn't
select database.");
$dateupdated = date("l dS M. Y h:i a");
mysql_query("UPDATE content SET pagebody = '$pagecontent'
lastupdated = '$dateupdated' WHERE id = 20");
// The code above will update the database with
the newly submitted content and also capture the
current date and time and store it in the variable
$dateupdated which will also be stored in the
database and eventually displayed on the final page.
?>
<HTML>
<HEAD>
<TITLE>Update Record</TITLE>
</HEAD>
<BODY>
<h3>Your page has been updated.</h3>
<P><a href="updated_page.php">View changes here</a></P>
// The above option lets the user view the page
they have just updated
</BODY>
</HTML>
Dynamic Content Page
So, how does our formatted content appear on the Website? The following is an example of a dynamic page that might use the newly formatted data (now stored in the database):

The code for the above page is:
<HTML>
<HEAD>
<TITLE>Dynamic Content Page</TITLE>
</HEAD>
<h3>Dynamic Content Page</h3>
<?php
mysql_connect('localhost','baggins','adventure');
mysql_select_db('contentdb');
$sql_result = mysql_query("SELECT pagebody, lastupdated
FROM content WHERE id = 20");
$content = mysql_fetch_array($sql_result);
$pagecontent = $content["pagebody"];
$displaydate = $content["lastupdated"];
echo "$pagecontent" ;
echo "<p> </p>";
echo "<p>Date Last Updated: $displaydate</p>" ;
?>
</BODY>
</HTML>
It's that easy! Creating an interface for your CMS that allows users to easily format the content they've submitted is a cinch witn Editize! Good luck with your site's CMS.