[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 308
  • Last Modified:

need to edit file on server with rte

i have the code below
i want to use the rte i have to edit files on my server
it works fine for one file but i want to edit others
how do i make it pass a value that php can use to denote what files to use
how can i pres the link and have it load and save the data for the matched file.

i tried to use include to load another rte but this ones special cant have code on the same page, and cant use the div/textbox example as i dont want to click on each box i only want one to show up at a time so i figured id pass the values via a link to denote what file im on and what file to edit

but haven't got a clue how to do that

thank you in advance for any code or help you may provide

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
<title>LCW - Admin Section: Content</title>

<!-- Skin CSS file -->
<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.8.0r4/build/assets/skins/sam/skin.css">
<!-- Utility Dependencies -->
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/yahoo-dom-event/yahoo-dom-event.js"></script> 
<script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/element/element-min.js"></script> 
<!-- Needed for Menus, Buttons and Overlays used in the Toolbar -->
<script src="http://yui.yahooapis.com/2.8.0r4/build/container/container_core-min.js"></script>
<script src="http://yui.yahooapis.com/2.8.0r4/build/menu/menu-min.js"></script>
<script src="http://yui.yahooapis.com/2.8.0r4/build/button/button-min.js"></script>
<!-- Source file for Rich Text Editor-->
<script src="http://yui.yahooapis.com/2.8.0r4/build/editor/editor-min.js"></script>
<script src="js/yui-image-uploader26.js"></script>
</head>
<?
if(isset($_POST['msgpost']))
{
    $sContent = stripslashes($_POST['msgpost']);
       //Form was submitted
       $fp = fopen("../index_bottom_left_panel.php","w");
       if (fwrite($fp, $sContent))
       {
         $sHeader .=" Successfully wrote to file.";
         //echo "content: ".$sContent;
      }
       else
       {
           $sHeader .=" Error writing to file.";
        }
  } else {
    $sHeader = 'You may edit the content... Nothing submitted yet';
    $sContent= file_get_contents("../index_bottom_left_panel.php");
  }




/*
../index_bottom_left_panel.php
../index_bottom_middle_panel.php
../index_top_right_panel.php
../index_footer_right_area.php

edit the file from what content we have now
make  flag of witch file we are useing and pass value each time in url link
need to show what page we are editing
*/





  ?>
<body class="yui-skin-sam"> 
			
				<a href="#tabs-1">Bottom Left Panel</a> |
				<a href="#tabs-2">Bottom Middle Panel</a> |
				<a href="#tabs-3">Top Right Panel</a> |
				<a href="#tabs-3">Footer Right Area</a>
			 
			<div >
			    
			    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
			    <textarea name="msgpost" id="msgpost" cols="50" rows="10"><?php echo $sContent;?></textarea>
			    <input id="FormSubmit" type="submit" name="save" value="Submit" />
			    <input type="reset" name="reset" value="Reset" />&nbsp;&nbsp;&nbsp;<?php echo $sHeader;?>
			    </form>
			    <script type="text/javascript">

				var myEditor = new YAHOO.widget.Editor('msgpost', {
				    height: '300px',
				    width: '522px',
				    dompath: false, //Turns on the bar at the bottom
				    animate: true //Animates the opening, closing and moving of Editor windows

				});
				yuiImgUploader(myEditor, 'msgpost', 'yui_img_uploader.php','image');
				myEditor.render();

				//Inside an event handler after the Editor is rendered
				YAHOO.util.Event.on('FormSubmit', 'click', function() {
				    //Put the HTML back into the text area
				    myEditor.saveHTML();
				    myEditor.handleSubmit(true);

				    //The var html will now have the contents of the textarea
				    var html = myEditor.get('msgpost').value;

				    //var html = myEditor.getEditorHTML('msgpost').value;
				    //var html = myEditor.get('element').value;
				    document.msgpost.textEntered.value = html;
				});


				</script>
			</div> 

	<!-- END TABBED PANEL EXAMPLE-->                                      

</body>
</html>

Open in new window

0
Johnny
Asked:
Johnny
  • 2
  • 2
1 Solution
 
VanHackmanCommented:

Hi again Bro!.

I code a full example to you!. =P

I attached all the files, you just download all the files, and install the scripts in some folder of your server.

Create two folders:

"your" and in the folder "your" create the folder "Directory" and put some text or html files on it.

The main script is the "YUI-Plus.php" file.
The example read all the files on "your/Directory" folder, and display a list of them, when you click in some file it is loaded to the editor and you can edit it, when you click in the "submit" button the file is updated when the new content, and you will see a message about it.

I hope that my code helps you and don't forget give me some points! =P
YUI-Plus.php
LoadFile.php
EditFile.php
browser.php
0
 
JohnnyAuthor Commented:
can you try this one
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_25044553.html
thanks ever so much

id NEVER of come up with a solution like the one you presented with the file folder that exceeds what i was looking for and meet our needs so much better

thanks
0
 
JohnnyAuthor Commented:
this is a church project we are surly blessed by your help
0
 
VanHackmanCommented:
Thanks a lot for the points.
I am glad to help you!.

~VanHackman
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now