Jump to content

Posting info from CKEditor to txt file


lqdmindz

Recommended Posts

Hi guys,

 

i currently have a page in my phpbb that has the CKEditor on it.  Below is the editor.php

 

<?php
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
    
  if ($user->data['user_id'] == ANONYMOUS)
{
    login_box('', $user->lang['LOGIN']);
} 

page_header('Editor');

$template->set_filenames(array(
        'body' => 'editor.html',
));

make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();  
?>    

 

And here is the HTML page editor.html

 

<!-- INCLUDE overall_header.html -->

  <script type="text/javascript" src="/ckeditor/ckeditor.js"></script> 

  <textarea name="text1"></textarea>

  <script type="text/javascript">
    CKEDITOR.replace( 'text1' );
  </script>


<!-- INCLUDE jumpbox.html -->
<!-- INCLUDE overall_footer.html -->

 

I would like to submit the info from the textarea to a file called announce.txt.  Could anyone help me out with this?

Link to comment
https://forums.phpfreaks.com/topic/207921-posting-info-from-ckeditor-to-txt-file/
Share on other sites

Well you're going to need to put a form with a submit button around that text area, with method="post' and action="save.php".  Then in save.php, something like:

 

file_put_contents('announce.txt', $_POST['text1']);

Thanks for that.  Prior to reading this i managed to work out the form part.  It all works well now.  But my output file save.php is quite plain.  How would i wrap it in PHPBB headers and footers?

 

I wouldn't.  I would have a redirect after the file save that redirected them back to a certain page.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.