Posts

Showing posts from February, 2015

adds a unique CSS class to a single, specific nav menu item.

function my_special_nav_class( $classes, $item ) { if ( is_single() && $item->title == 'Blog' ) { $classes[] = 'special-class'; } return $classes; } add_filter( 'nav_menu_css_class', 'my_special_nav_class', 10, 2 );

Create menu for bootstrap in wordpress

create a file of name wp_bootstrap_navwalker.php  and put this code in it

show loader till the last ajax request is not completed

ajaxstop  :  Whenever an Ajax request completes, jQuery checks whether there are any other outstanding Ajax requests. If none remain, jQuery triggers the  ajaxStop  event $(document).ajaxStop(function () {         // jquery to hide your loader }

check uniqueness in codeigniter formvalidation when editing

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Form_validation extends CI_Form_validation {     function __construct(){         parent::__construct();     }     function error_array(){         return $this->_error_array;     }     public function is_unique($str, $field) {         $field_ar = explode('.', $field);               $query = $this->CI->db->get_where($field_ar[0], array($field_ar[1] => $str), 1, 0);         if ($query->num_rows() === 0) {             return TRUE;         }         return FALSE;     } function unique_check($str, $field) { list($field,$exclude)=explode(',', $field); list($table, $field) = explode('.', $field); if(!empty($exclude)) { list($field_name, $post_field) = explode('.', $exclude); $value= $this->CI->input->post($post_field); $this->CI->db->where_not_in($field_name,$value);   }

Add more function in codeigniter form validation library

add library of MY_Form_validation and add function that you want to add in form validation library <?php if ( ! defined ( 'BASEPATH' )) exit ( 'No direct script access allowed' ); class MY_Form_validation extends CI_Form_validation { function __construct(){ parent :: __construct (); } function error_array(){ return $this -> _error_array ; } } and call function in your controller if ( $this -> form_validation ->run()){ }else{ $this->form_validation->error_array(); } error_array will return all the required parameter that you will getfrom  form_error('field_name')

google api to find path between two places

A simple example of using google map to find a path between two places http://jsfiddle.net/gHK7s/2/

Disable click outside of bootstrap modal area to close modal view

There are various method for disable click of Bootstrap modal area to close modal 1) $ ( '#myModal' ). modal ({ backdrop : 'static' }) ; 2) <button data-target = "#myModal" data-toggle = "modal" data-backdrop = "static" > show modal </button> ` 3) $ ( '#myModal' ). modal ({ backdrop : 'static' , keyboard : false })

Database for the world currency

get the database of the world currency in the below link https://drive.google.com/file/d/0B7Y5R-pYvksgbXdlZ1NLZDlIeFk/view?usp=sharing

currency converter

if you want to get current rate of currency use this url  this will provide you current rate of currency in respect to the  FromCurrency  to the  ToCurrency  have a try  in xml format http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=INR

merging the two table in my sql

UPDATE firsttablename SET coloum_name = ( SELECT coloum_name FROM second_table b WHERE firsttablename . coloum_name = b . coloum_name )

codeigniter unique check on editing a field

function unique_check( $str , $field , $exclude = '' ) { list ( $table , $field ) = explode ( '.' , $field ); if (! empty ( $exclude )){ list ( $field_name , $value ) = explode ( '.' , $exclude ); $this -> db ->where_not_in( $field_name , $value ); } if ( isset ( $this -> db )) { $query = $this -> db ->limit( 1 )->get_where( $table , array ( $field => $str )); return $query ->num_rows() === 0 ; } return FALSE ; } $this ->unique_check( 'test@domain.com' , 'tablename.coloum_name' , 'coloum_name.coloum_value' );