Skip to main content

Posts

Implementation of CKEDITOR with javascript

Implementation of CKEDITOR with javascript Html Portition             <!DOCTYPE html> <html>     <head>         <meta charset="utf-8">         <title>CKEditor</title>         <!-- Make sure the path to CKEditor is correct. -->         <script src="../ckeditor.js"></script>     </head>     <body>         <form>             <textarea name="editor1" id="editor1" rows="10" cols="80">                 This is my textarea to be replaced with CKEditor.             </textarea>         </form>     </body> </html> Script Portition <script>     $(function(){   ...

Create Plugins in Cakephp

How To Create Plugins in CakePHP Step 1: inside /app/Plugin Folder create a folder "Admin" Here "Admin" is plugin name. Step 2: How to load plugin. Either you load Plugin in bootstrap.php file or in any controller action. Use: CakePlugin::load('Admin'); /app/Plugin/Admin/Model/AdminAppModel.php: class AdminAppModel extends AppModel { } Step 3: Create Controller inside plugin // app/Plugin/Admin/Controller/ContactsController.php If you want to be able to access your plugin with a URL, defining an AppController for the plugin is required. App::uses('AppController', 'Controller'); class AdminAppController extends AppController { } class ContactsController extends AdminAppController { public $uses = array('Admin.Contact'); public function index() { //... } } Note: You can do inter-plugin communication by using $this->requestAction('/plugin_name/controller_name/action...

Google reCAPTCHA using PHP and jQuery

Google reCAPTCHA using PHP and jQuery. A CAPTCHA is a program that protects websites against bots by generating and grading tests that humans can pass but current computer programs cannot. It is usually a graphic image with a series of distorted letters on an equally distorted or multicolored background. Google has released the new reCAPTCHA . Using reCAPTCHA users can prove they are human without solving a CAPTCHA. Steps for google reCAPTCHA implementation. 1. Create a secure key and site key Register your site at Google from here – https://www.google.com/recaptcha/admin      2. Html Code Now first of all include Google reCAPTCHA javascript library. <script src="https://www.google.com/recaptcha/api.js" async defer></script> Now in form body section add reCAPTCHA DIV element <form action="" method="POST">     <input type="text" name="name" value="" />     <input type="text" name=...

Search Table Row by jquery

Search Table Row by jquery Search content from table using jQuery. Live searching method via jquery Create function to remove highlight content. If content not matched. function removeHighLighting (elm){         elm.each(function(){             var element = $(this);             element.replaceWith(element.html());         })     } Create function to highlight matched content. function addHighLighting (elm, data){         var text = elm.text();         var highlightedText = '<em>' + data+ '</em>';         var newText = text.replace(data, highlightedText);         elm.html(newText);     } Search text on keyup $("#search").on("keyup", function() {     ...

Server Side Datatable handling using PHP and MySql

Server Side Datatable handling using PHP and MySql jQuery datatable server side processing. Using jQuery Ajax and MySql. Step 1: View Layout for display Student Record index.html  <!DOCTYPE html> <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />         <title>Server Side Datatable handling</title>         <link rel="stylesheet" id="font-awesome-style-css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" media="all">         <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.9/css/jquery.dataTables.min.css"/>                 <script type="text/javascript" charset="utf8" src="http://ajax.aspnetcdn.com/ajax/jQue...

PHP Save Image in Base64 Encode Format

Save image in database in base64_encode format. 1. Create HTML Form <!DOCTYPE html> <html> <body> <form action="upload.php" method="post" enctype="multipart/form-data">     Select image to upload:     <input type="file" name="to_upload" id="fileToUpload">     <input type="submit" value="Upload Image" name="submit"> </form> </body> </html> 2. Now in upload.php if(!empty($_FILES)){     $extension = pathinfo($_FILES["to_upload"]["tmp_name"], PATHINFO_EXTENSION);     $image_content = file_get_contents($_FILES["to_upload"]["tmp_name"]);     $image_content = base64_encode($image_content);     $binaryData = 'data:image/' . $extension . ';base64,' . $image_content; } Store $binaryData value in database. 3. Html form your you need to display. <img src="<?php...

Refresh a particular div jQuery

Refresh a particular div jQuery Method 1: How to refresh a particular div content when page is loading through ajax load() function <ul id="nav" class="nav" style="font-size:12px;"> <li><a href="#" data-url="location.html">Location</a></li> <li><a href="#" data-url="multi.html">Multi-Location</a></li> </ul> <div id="home"></div> $('#nav a').on('click', function(e){      e.preventDefault();      $('.active').removeClass('active'); // removes the active class from other link      $(this).addClass('active'); // adds the active class to current cliked link      setInterval(function(){        $("#home").load($('.active').data('url'),{},function(){}); // populates the div with data-url of active class.      }, 5000); }); $('#nav li:eq(0) a').trigge...