I am working on a CMS, how can i find a string within an html document to edit then replace it... I use the following code and editworkspro as the wysiwyg editor.
<?php
// Call editworkspro
ob_start();
include_once("/home/www/". $user ."/admin/ewp/class.ewp.php");
$myEWP = new EWP;
$myEWP->SetDebugMode("Boolean mode");
$myEWP->SetName("admin");
//$myEWP->SetImagePath("http://". $_SERVER['HTTP_HOST'] ."/', 'images/");
// IMAGE PATH -- : ("http://". $_SERVER['HTTP_HOST'] ."/', 'images/"); "/home/". $user ."/www/images"
$myEWP->SetDimentions(750, 550, 50, 8);
$myEWP->SetEditorMode("full");
if(@$_POST["save"] == "true"){
$fileContent = $myEWP->GetValue("admin");
$filename = "/home/". $user ."/www/" . $file . ".html";
$handle = fopen($filename, "w");
fwrite($handle, $fileContent);
fclose($handle);
echo $file . " saved!<br><br><a href='index.php'>Continue Editing Pages</a>";
}else{
// get contents of html file into a string & send it to the editor
$filename = "/home/". $user ."/www/" . $file . ".html";
$handle = fopen($filename, "r");
$html = fread($handle, filesize($filename));
fclose ($handle);
// Place $html into EWP
$myEWP->SetValue($html);
?>
<form action="load.php?USER=<? echo $user; ?>&FILE=index" method="post">
<input type="hidden" name="save" value="true">
<?php
$myEWP->ShowControl("admin");
?>
<input type="submit" value="Save">
</form>
<?php
$myEWP->ShowFinish("admin");
}
?>
What happens is editworkspro doesn't reconginze my margin settings in my <body> tags..
That causes me grief.. So..
Is there a way that i can take the code after the html data has be edited by the editor but before the document is written and/or saved, that i can replace the <body> string to what i need it to be...??????
thank you very much if you can help!