Personal Online PHP HTML Editor Source Code

Today, We want to share with you Personal Online PHP HTML Editor Source Code.
In this post we will show you Online PHP Code Editor, hear for How to Create a Personal Online PHP Editor we will give you demo and example for implement.
In this post, we will learn about PHP Online Editor – PHP Online IDE – PHP Coding Online with an example.

Personal Online PHP HTML Editor Source Code

There are the Following The simple About Personal Online PHP HTML Editor Source Code Full Information With Example and source code.

As I will cover this Post with live Working example to develop , so the some major files and Directory structures for this example is following below.

  • index.php
  • live-file-set.php
  • code-editable.php
  • editor-action.js
  • style.css
READ :  ASP.NET UpdateProgress control Tutorial with Examples

Converting HTML Textarea into Code Editor

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.

[php]

Editor

http://assets/jQuery/jQuery.js
http://assets/assets.js

http://editor-action.js
http://assets/mode/htmlmixed/htmlmixed.js
http://assets/mode/xml/xml.js
http://assets/mode/javascript/javascript.js
http://assets/mode/css/css.js
http://assets/mode/clike/clike.js
http://assets/mode/php/php.js
http://assets/addon/selection/active-line.js
http://assets/addon/edit/matchbrackets.js



[/php]

Set Online PHP editable

code-editable.php
[php]

[/php]

PHP Write Editor Source code to a File Dynamically

live-file-set.php
[php]

[/php]

Online Editor using jQuery AJAX

editor-action.js – Executing Code with Online Editor using jQuery AJAX
[php]
$(document).ready(function(){
var codeEditorElement = $(“.codemirror-textarea”)[0];
var livechk = CodeMirror.fromTextArea(codeEditorElement, {
mode: “application/x-httpd-php”,
lineNumbers: true,
matchBrackets: true,
theme: “ambiance”,
lineWiseCopyCut: true,
undoDepth: 200
});
livechk.setValue(”);

READ :  Top 10 Advanced ASP.NET MVC Interview Questions And Answers

$(document).on(‘click’, ‘#run’, function(e){
e.preventDefault();
$(“#live_err”).html(“”).hide();
var sourceCode = livechk.getValue();
if(sourceCode != ”){
$.ajax({
url: ‘live-file-set.php’,
type: ‘POST’,
dataType: ‘json’,
data: {“input”:sourceCode},
success:function(output_results){
},
complete:function(){
$.ajax({
url: ‘code-editable.php’,
type: ‘GET’,
success:function(output_results){
console.log(“output_results: “+output_results);
$(“#preview”).html(output_results) ;
},
error:function(){
console.log(“live_err: “+output_results);
}
});
}
});

} else{
$(“#live_err”).html(“Sorry, Code should not be empty”).show();
}

});

$(document).on(‘click’, ‘#clear’, function(e){
e.preventDefault();
$(“#live_err”).html(“”).hide();
livechk.setValue(”);
});

$(document).on(‘click’, ‘#refresh’, function(e){
e.preventDefault();
$(“#live_err”).html(“”).hide();
location.reload();
});
});
[/php]

Custom Style CSS

style.css
[php]
body {
font-family: Arial;
}
.live-btn-option {
background: #1f201f;
padding: 8px 25px;
margin-right: 10px;
border: #101010 2px solid;
color: #ccc;
}
.add-new-rec {
margin-top: 20px;
}

#preview {
border: #d0d0d0 2px solid;
padding: 10px;
min-height: 100px;
}

#live_err {
display:none;
color: #d63f3f;
}
[/php]

READ :  ASP.NET Web Forms Tutorial with Examples

Personal Online PHP HTML Editor – Output

personal-online-php-editor-output

jQuery 15 Powerful Tips and Tricks for Developers and Web Designer

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Create a Personal Online PHP HTML Editor.
I would like to have feedback on my Infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Reply

Your email address will not be published. Required fields are marked *