Category Archives: PHP

Dynamic base url : CodeIgniter and Zend Framework

1 2 3 $base_url = ((isset($_SERVER[’HTTPS’]) && $_SERVER[’HTTPS’] == "on") ? "https" : "http"); $base_url .= "://".$_SERVER[’HTTP_HOST’]; $base_url .= str_replace(basename($_SERVER[’SCRIPT_NAME’]),"",$_SERVER[’SCRIPT_NAME’]);  

Posted in CodeIgniter, PHP, Zend Framework

Get multiple arrays values simultaneously in single loop

$a = array(1,2,4); $b = array(’a',’b',’c');   foreach (array_map(null, $a, $b) as $v) { list($v1, $v2) = $v; echo $v1 . $v2 ; }

Posted in PHP, PHP-Tips

Curl: SSL certificate problem, verify that the CA cert is OK

< ?php   public function uploadAction() { $this->_helper->layout->disableLayout();   require_once(’TC/Kaltura/KalturaAPI.php’); $kalturaAPI = new TC_Kaltura_ConfigForTC(); $client = $kalturaAPI->kalturaKS();   $request_url = ‘https://www.kaltura.com/api_v3/index.php?service=media&action=upload’; $post_params[’name’] = urlencode(’Test User’); $post_params[’fileData’] = ‘@’.'C:\Users\yashpal.QAI\Desktop\Graph – Video\no rubric selected.avi’; $post_params[’submit’] = urlencode(’submit’); $post_params[’ks’] = $client->getKs();     … Continue reading

Posted in PHP, Zend Framework Tagged ,

Zend Framework Zend_Form Decorators

Here are few links for depth understanding of Zend Framework Zend_Form Decorators http://framework.zend.com/manual/en/zend.form.standardDecorators.html http://www.slideshare.net/weierophinney/leveraging-zendform-decorators http://devzone.zend.com/article/3450

Posted in Zend Framework

Run PHP from HTML – .html as .php – Execute PHP in .html

How can I execute PHP code on my existing myfile.html page?: When a web page is accessed, the server checks the extension to know how to handle the page. Generally speaking if it sees a .htm or .html file, it … Continue reading

Posted in CodeIgniter, PHP, PHP-Tips

Insert accounts in Sugar CRM using Codeigniter

//load new database of Sugar CRM as defined in database.php $this->db2 = $this->ci->load->database(’db_crm’, TRUE);   //generate unique id for sugar crm . length:36 $accounts_id=$this->generateCrmID(’accounts’);   //insert account into CRM $account_data=array( ‘id’=> $accounts_id, ‘name’=> $user_details[’first_name’].’ ‘.$user_details[’last_name’], ‘date_entered’=> date(’Y-m-d h:i:s’), ‘date_modified’=> date(’Y-m-d … Continue reading

Posted in CodeIgniter, PHP Tagged , ,

Insert ticket in Support Suite using CodeIgniter

// Insert the Actual Record $ticket_data=array( ‘ticketid’=>”, ‘ticketmaskid’=>$ticketmaskid , ‘departmentid’=>1 , ‘ticketstatusid’=>1 , ‘priorityid’=> 1, ‘emailqueueid’=>0 , ‘userid’=>68 , ‘staffid’=>2, ‘ownerstaffid’=>2, ‘assignstatus’=>1, ‘fullname’=>’someva’ , ‘email’=>$user_details[’email’] , ‘lastreplier’=>’someva’ , ‘replyto’=>$user_details[’email’] , ‘subject’=>’New Account is registered’ , ‘dateline’=>now() , ‘lastactivity’=>now() , ‘laststaffreplytime’=>now() … Continue reading

Posted in CodeIgniter, PHP Tagged , ,

SEO based urls : CodeIgniter routes

You can use this code for SEO urls   //this section enables you to use some controllers $route[’admin/(:any)’] = "admin/$1"; $route[’contact/(:any)’] = "contact/$1"; $route[’auth/(:any)’] = "auth/$1"; $route[’testimonials/(:any)’] = "testimonials/$1";   //else everything in url will handle by this pro controller’s … Continue reading

Posted in CodeIgniter, Newbie, PHP Tagged ,

Automatic Config BASE URL in CodeIgniter

Change $config['base_url'] with this. This is one time set config system for all sites and urls. In application/config folder open config.php Find this $config[’base_url’]=’http://example.com’; and replace with this   $config[’base_url’] = ((isset($_SERVER[’HTTPS’]) && $_SERVER[’HTTPS’] == "on") ? "https" : "http"); … Continue reading

Posted in CodeIgniter, PHP Tagged , , ,

Insert user in Support suite using CodeIginiter

Paste following code in end of database.php located in config folder $db[’db_support’][’hostname’] = "localhost"; $db[’db_support’][’username’] = "dbname"; $db[’db_support’][’password’] = "password"; $db[’db_support’][’database’] = "supportsuite_databasename"; $db[’db_support’][’dbdriver’] = "mysql"; $db[’db_support’][’dbprefix’] = ""; $db[’db_support’][’pconnect’] = TRUE; $db[’db_support’][’db_debug’] = TRUE; $db[’db_support’][’cache_on’] = FALSE; $db[’db_support’][’cachedir’] = … Continue reading

Posted in CodeIgniter, PHP, PHP-Tips Tagged , ,