Posts

my notepad code notes

 /*********************SHORT CODE***********************/ function event_shortcode_display_post($attr, $content = null){       $args = array(                     'category_name'  => '',                     'posts_per_page' => '3',                     'order'          => 'desc',                     'post,'          => 'post',   'post_status' =>'publish'                  );                             $recent_posts = get_posts($args); if(isset($_GET['test'])){ /* echo "<pre>"; print_r($recent_posts);die; */ }     $output = '<ul class="postslide">';       foreach ($recent_posts as $eventpost) : $cat=''; $categories=get_the_category($eventpost->ID);         $thumbid=get_post_thumbnail_id($eventpost->ID); $url=wp_get_attachment_image_url($thumbid,'original'); $display_name = get_the_author_

React.js Notes

Image
1.   C oncatenate         2 var data  + in one var (2 var ke data ko jodta hai  js mai); 2.What are the Components? what are you doing Components are  independent and reusable bits of code . They serve the same purpose as JavaScript functions, but work in isolation and return HTML via a render() function. Components come in two types, Class components and Function components 3.Types of React Components  Functional Components. Class Components. Pure Components. Higher-Order Components. 4.jquery wich always using  id is # for example(#abc) 5. 3 type of HTML data output in js 1)HTML .2)text .3)append mens repet input field or data 6.  onkeypress function in js is function mai agr input field mai koi v data type krenge to output mai koi changes ni hoga  7...3 type of function create in js i)   function get_onkeypress(e){   document.getElementById('onkeypress').value=e;   }  (normal function); ii )var demo=function(asd){ console.log('gvshdsgvg',asd); };( variable ke sath dec

condition in table data for html

                               EK TABLE DATA MAI CONDITION DI HAI KI AGR CONDITION TRUE HOTI HAI TO MTLB MAIL SEND HOTI HAI AGR TO FIELD COLOR GREEN(SUCCESS) HO JAE NAHI TO ORANGE(WARNING) RAHE......                                  <td>                                 <?php if($item->send_mail == "1"): ?>                                 <label class="label label-success">                                 Success                                 </label>    <?php else: ?>                                 <label class="label label-warning">                                 No send mail                                 </label>                                 <?php endif; ?>                                 </td>

API

route==$route['webapi/app/(:any)/?(:any)/?(:any)/?(:any)'] = 'api/index'; contrloer=<?php /** * create all api details..... ** *  www.domain.com/webapi/app/top-header ** * */  error_reporting(0); header("Access-Control-Allow-Origin: *"); header("Access-Control-Allow-Headers: *"); class Api extends MY_Controller{ var $status="error"; var $msg="No found data."; var $data="No found data."; public function index(){ $type = $this->uri->segment(3); witch($type){ case 'invoices': $this->data=$this->get_invoices(); break; case 'get_invoices_by_id': $this->data=$this->get_invoices_by_id(); break; case 'register': $this->data=$this->register(); break; } $set['status']=$this->status; $set['msg']=$this->msg; $set['data']=$this->data; echo json_encode($set,JSON_ERROR_CTRL_CHAR); } /* public function register(){ $id=$this->input-

Session With Login

<?php require_once( 'db.php' ); global $conn,$db; // If form submitted, insert values into the database. //1st step data get with method.... if (isset($_POST[ 'login_submit' ])){ $email = $_POST[ 'email' ]; $password = $_POST[ 'password' ]; //2nd step query insert and check the connection..... $sql_query = " SELECT * FROM `register` WHERE email = '$email' " ; $query = mysqli_query($conn,$sql_query) or die ( 'Please check mysqli:' .$sql_query); //3step result check in num rows with condition.... $result = mysqli_num_rows($query); if ($result > 0 ){ $rows=mysqli_fetch_array($query); $db_password=$rows[ 'password' ]; if (md5($password) == $db_password){ $_SESSION[ 'login_name' ] = $email; header( "Location: fetch_data.php" ); } else { $_SESSION[ 'msg' ] = 'password not match.' ;

task ajax

 1. json_encode 2. __dir__ 3.

Image upload in CI with Ajax

Controlar==> public function Register(){ $data[ 'main_content' ] = 'ajax' ; $this ->load->view( 'partials/header' ,$data); $this ->load->view( 'ajax' , $data); $this ->load->view( 'partials/footer' ,$data); } public function register_post(){ $target_dir =dirname(dirname( __dir__ )) . "/uploads/" ; $target_file = $target_dir . basename($_FILES[ "image" ][ "name" ]); $filetmp_name = $_FILES[ "image" ][ "tmp_name" ]; if (move_uploaded_file($filetmp_name, $target_file)) { $set=array( 'data' => 'uploooo' , 'status' => '1' , ); echo json_encode($set); } else { $set=array( 'data' => 'image is not uploded' , 'status' => '0' , ); echo jso