Top Menu

Category Archives Php

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'))."&nbsp;&nbsp;&nbsp;". $this->Paginator->prev('«…

Mail Function with Attachments in php<?phpfunction mailWithAttachments($fileName, $filepath, $mailto, $fromMail, $fromName, $replyTo, $subject, $message) { $file = $filepath.$fileName; $file_size = filesize($file); $handle = fopen($file, "r"); $content = fread($handle, $file_size); fclose($handle); $content = chunk_split(base64_encode($content)); $uid = md5(uniqid(time()));//for unique number generate $name = basename($file); $header = "From: ".$from_name." <".$fromMail.">rn"; $header .= "Reply-To: ".$replyTo."rn"; $header .= "MIME-Version: 1.0rn"; $header .= "Content-Type: multipart/mixed; boundary="".$uid.""rnrn";…

Pagination ClassCodeIgniter's Pagination class is very easy to use, and it is 100% customizable, either dynamically or via stored preferences.Here we will tell create paging in codeignator.Create Model class modelname extends CI_Model{function __construct()    {        parent::__construct();        $this->load->database();    }function get_all_posts($limit, $offset)    {        //get all entry        $query = $this->db->get('entry', $limit, $offset);;/****entry is table name *******/        return $query->result();    }}Controller class controllername extends CI_Controller{      function…

How can change div, span etc position   randomly ?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Welcome to Notizza</title><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script><style>.tip1 { width:44px; height:30px; vertical-align:middle; text-align:center; font-weight:bold; color:#222; line-height:30px; padding-right:6px; background:url(../images/bubble1.png) 0 0 no-repeat; z-index:100; margin-top:5px;}.toolTip { position: relative; }.toolTip a { text-decoration: none; text-align: center;}.toolTip .alt { display: none;}.toolTip a:hover ~ .alt { display: inline; padding: 6px; margin:…

Auto Generate Password and User Function  class GeneratorComponent extends Object{                // Numeric Arrayvar $_array_numeric      = array(1,2,3,4,5,6,7,8,9);                // Alphabet Array                var $_array_alpha            = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');                /**                # Function                           : GeneratePassword                # Create Date    : 02-12-2011                # Description     : Generate password in random order.                # Arguments                      : None                # Return                              : Password                */                function GeneratePassword(){                                                $array_pass        =  $this->_array_numeric;                                $array_pass_alpha          =            …

Close