January 5, 200917 yr hi all ok i have set up fck editor and i whant it to edit just part of a a page eg about_us.php but just change part of the file between 2 tags <?php include "inc/header1.php" ?> <title></title> <?php include "inc/header2.php" ?> <?php $image = "about_us.jpg"; ?> <!-- BEGIN EDIT 1 --> i would like this only to be editable thank you </p><!-- END EDIT 1 --> <?php include "inc/footer.php" ?> thanks again
January 6, 200917 yr You'd need to use preg_replace // $content = contents of file as string // $new_content = 'lol'; $tag1 = '<!-- BEGIN EDIT 1 -->'; $tag2 = '<!-- END EDIT 1 -->'; $content = preg_replace("/$tag1(.*?)$tag2/", "$tag1 $new_content $tag2", $content); Then write $content back to the file.
January 8, 200917 yr Author You'd need to use preg_replace // $content = contents of file as string // $new_content = 'lol'; $tag1 = '<!-- BEGIN EDIT 1 -->'; $tag2 = '<!-- END EDIT 1 -->'; $content = preg_replace("/$tag1(.*?)$tag2/", "$tag1 $new_content $tag2", $content); Then write $content back to the file. thank you just what i was after
Create an account or sign in to comment