hi guys any idea how i can insert a whole html code in $content please ? basically i want to paste my html template after $content ='whole html code goes here' any ideas ? thanks in advance

<?
if(isset($_POST['save']))
{
$pagename = $_POST['pagename'];
$content = 'test';

$filename = "cms/pages/$pagename.php";
$filehandle = fopen($filename, 'w') or die("can't open file");

fwrite($filehandle, $content);

fclose($filehandle);
}
?>

You could include it. Your included file could be a PHP file containing the html with a $content = " statement before it.

You could also use fread to read it into $content.

Odysea,

Templating is complex enough for most php programmers to use a 3rd party class/suite for the job. In such suites, much of the hard work has been done for you. Instead, all you have to do is install and learn how to drive them!

Here's an (old) discussion - there are many more (Google "php template engine"):
http://www.sitepoint.com/forums/showthread.php?threadid=123769

Airshow

i dont wont to give up on it yet.

is there any way to insert this:

include '../core/config.php';
include '../core/opendb.php';

$query = "SELECT id, name, content, updated ". "FROM news ". "WHERE id = '1'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $name, $content, $updated) = mysql_fetch_array($result, MYSQL_NUM);

include '../core/closedb.php';

into this:

<? $template = "template goes over here..."; ?>

i will be glad if if i solve this issue. thanks in advance

i dont wont to give up on it yet.

I have always admired fortitude.

Airshow

I have always admired fortitude.

Airshow

and i always appreciate help :)