i got a requirment wherein i user add date in US(English) format but user want to display spanish language/or Other Language.First Method :/* Windows con apachesetlocale(LC_TIME, 'Spanish'); *//* Apache con linux *//* setlocale(LC_TIME, 'es_ES'); */// setlocale(LC_TIME, 'de_DE'); // echo strftime('%A, %d. %B %Y'); /* setlocale(LC_TIME, 'es_MX'); */setlocale(LC_TIME, 'es_ES'); //pase language code echo $fecha=strftime('%B %d %Y',strtotime('01-09-2012'));// Output septiembre 01 2012Second Method function converttospanish($paramdate){$str=$paramdate;$month = array("","enero", "febrero",…
Recently when working on my site i got a requirment wherein i user can add multiple input text on page in different textboxes, and these textboxes needs to be created dynamically as per user need. So i decided to do it in jQuery. it’s quite easy to add or remove a textbox dynamically. The idea is quite simple, just combine…
Learn how to use the PHP GD library in your PHP program to generate dynamic images. Learn how to create and manipulate the GIF, PNG and JPG images.<?php# Note: Install GD laibreries $filename = '194_card.jpg';//orignal file $filename1 = '1.png';//save file name whoes you save list($current_width, $current_height) = getimagesize($filename);$left = 0; //crop left margin$top = 0;//crop right margin$crop_width = 1056; $crop_height = 400;$canvas = imagecreatetruecolor($crop_width,…
How can save images without use of browser with the help of Curl.Some time we need save url image help of code without open browser This function save image without open link.$url="http://google.com/imagename.jpg"; $ch = curl_init($url);$fp = fopen(‘folderpath/card1.jpg', 'wb');// folder path where you save imagecurl_setopt($ch, CURLOPT_FILE, $fp);curl_setopt($ch, CURLOPT_HEADER, 0);curl_exec($ch);curl_close($ch);fclose($fp);Note : One of the main reasons to use cURL to save…
How can import excel file data in mysql with the help of php. To import excel data into php-mysql records first create a table with required fields. Make database connection. Open excel file and read columns one by one and store in variables.First Method******************* import excel data to php code****************/$handle = fopen("Book1.csv", "r");while (($data = fgetcsv($handle)) !== FALSE) { $num…
Upload file without refreshing page in cakephp 1.controller/controlername_controller.php class DoctorsController extends AppController { var $name = 'Doctors'; public $uses= array('Doctor'); function changeprofilephoto() { $doctor_id = “14”; // $path = "../../app/webroot/profilepic/";//set path $valid_formats = array(".jpg", ".png", ".gif", ".bmp", ".jpeg");// if($this->data) { $this->Doctor->set( $this->data ); $name = $this->data["Doctor"]['profile_pic']['name']; $size = $this->data["Doctor"]['profile_pic']['size']; if(strlen($name)) { $fileExt = substr(strrchr($name, '.'), 0); if(in_array($fileExt,$valid_formats)) { if($size<(1024*1024)) {…
1. Controller/controllername.php class ControllerNameController extends AppController { var $name= 'ControllerName'; public $uses = array('TablesName');function inbox() { $this->paginate = array( 'conditions' => array('TablesName.receiver_delete'=>'0', 'AND'=>array('TablesName.user_to'=>$parameters ['id'])),'limit' => 10,'order' => array('TablesName.sent_date'=>'desc' ) ); $data = $this->paginate('TablesName'); $this->set('messages', $data); }views/elements/paging.ctp<?php echo "<div align='left' class='l1'>". $this->Paginator->counter(array('format' => 'Showing %page% to %pages% of %count% entries' )). "</div><div align='right' class='r1'>". $this->Paginator->first('First', null, null, array('class' => 'disabled'))." ". $this->Paginator->prev('«…
file upload with progress barjquery upload file with progress barStep 1.<html><head><title>Image upload without refresh page</title></head><scripttype="text/javascript"src="scripts/jquery.min.js"></script>//search this file on google <scripttype="text/javascript"src="scripts/jquery.form.js"></script> //search this file on google<scripttype="text/javascript">$(document).ready(function() { $('#photoimg').live('change', function(){ $("#preview").html(''); $("#preview").html('<img src="loader.gif" alt="Uploading...."/>'); //download load loading image $("#imageform").ajaxForm({ target: '#preview' }).submit(); }); }); </script><style>body{font-family:arial;}.preview{width:200px;border:solid 1px #dedede;padding:10px;}#preview{color:#cc0000;font-size:12px}</style><body><divstyle="width:600px"><formid="imageform"method="post"enctype="multipart/form-data"action='ajaximage.php'>Upload your image <inputtype="file"name="photoimg"id="photoimg"/><br><inputtype="text"id='tt'name='tt'></form><divid='preview'></div></div></body></html>Step 2. <?php$path = "img/"; // set image upload path $valid_formats = array(".jpg", ".png",…
While generating a report in your project, you might have to download the data into excel file using PHP. In most scenario, you have to display the report in a page and create a link to download the report in the excel file. Well in that scenario, i think i can help you with a simplified code of PHP and…
Security::hash($this->data['User']['password'], null, true);