Skip to main content

Posts

IONIC

======================== How To install ionic  ===================================== 1. node js 2. npm install -g ionic cordova ======================== Create APP =============================================== 1.  ionic start helloWorld blank > Try Ionic 4? (y/N) > Starter template: (Use arrow keys) ❯ tabs     | A starting project with a simple tabbed interface   blank    | A blank starter project   sidemenu | A starting project with a side menu with navigation in the content area   super    | A starting project complete with pre-built pages, providers and bes t practices for Ionic development.   tutorial | A tutorial based project that goes along with the Ionic documentati Install the free Ionic Pro SDK and connect your app? (Y/n) > Y ? What would you like to do?   Link an existing app on Ionic Pro ❯ Create a new app on Ionic Pro         <-| ? Which gi...

Angular

API FORMAT : host/project_dir/controller_name/method_name?param1=&param2=&param2=&param2= =============== Angular ==================  The ng-app directive tells AngularJS that this is the root element of the AngularJS application. All AngularJS applications must have a root element. You can only have one ng-app directive in your HTML document. If more than one ng-app directive appears, the first appearance will be used. An NgModule is a class marked by the @NgModule decorator. @NgModule takes a metadata object that describes how to compile a component's template and how to create an injector at runtime. JSON.parse() is for "parsing" something that was received as JSON. JSON.stringify() is to create a JSON string out of an object/array. They are the inverse of each other. JSON.stringify() serializes a JS object into a JSON string, whereas JSON.parse() will deserialize a JSON string into a JS object. URL : https://angular.io/cli =================...

Laravel

1. Run these commands in terminal's root >$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" >$ php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" Installer verified >$ sudo php composer-setup.php >$ php -r "unlink('composer-setup.php');" 2. To verify composer is installed or not > $ composer if installed display => Composer version 1.6.5 *** Usage:   command [options] [arguments] Options:   -h, --help                     Display this help message   -q, --quiet                    Do not output any message   -V, --version                ...

Creating a Custom Wordpress-API Endpoint

########## Creating a Child Theme ############ cd /var/www/html/wp-content/themes mkdir twentyseventeen-child Go to Appearance -> Themes in the WordPress admin and choose your child theme: Inside the theme folder, add a functions.php file with the following initial code: In the functions.php file of your theme, add the following code: add_action('rest_api_init', function () {   register_rest_route( 'mytwentyseventeentheme/v1', 'latest-posts/(?P<category_id>\d+)',array(                 'methods'  => 'GET',                 'callback' => 'get_latest_posts_by_category'       )); }); We’re using the register_rest_route() with the following parameters:     a namespace, mytwentyseventeentheme/v1     a resource path with a regex for catching the category ID, latest-posts/(?P<category_id>\d+)     an option array where we s...

SETUP SITE UNDER MAINTENANCE MODE

1. Enable hooks. Edit the application/config/config.php file and set $config['enable_hooks'] = TRUE; 2. Edit the application/config/config.php file and define a new config variable for maintenance mode. Insert the following code at the bottom of the config.php file. /* |-------------------------------------------------------------------------- | Maintenance Mode |-------------------------------------------------------------------------- | | For whatever reason sometimes a site needs to be taken offline. | Set $config['maintenance_mode'] to TRUE if the site has to be offline | | $config['maintenance_mode'] = TRUE; // site is offline | $config['maintenance_mode'] = FALSE; // site is online */ $config['maintenance_mode'] = TRUE; 3. To let the system know about the maintenance hook, edit the application/config/hooks.php file and define hook.     pre_system – Hook point. The hook will be called very early during system execution....

CI FILE UPLOAD

if(isset($_POST['uploadpic'])) { $userid = trim($this->input->post('userid')); $image = basename($_FILES["file"]["name"]); $wherei = array( 'id' => $userid ); $target_path = base_url('assets/userimages/'); $target_path = $target_path . basename($_FILES['file']['name']); if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) { $updatedata = array( 'image' => $image ); $update = $this->user_model->UPDATEDATA('user',$wherei, $updatedata); if($update){ $this->session->set_flashdata("success","Update Successfully."); redirect('user/profile'); }else{ $this->session->set_flashdata("failed","Update Failed."); redirect('user/profile'); } } else { $this->session->set_flashdata...

CI Validations

required // Returns FALSE if the form field is empty. matches // Returns FALSE if the form field does not match the defined value of parameter. is_unique // Returns FALSE if the form field is not unique to the table and field name in the parameter. min_length // Returns FALSE if the form field is shorter than the parameter value. max_length // Returns FALSE if the form field is longer than the parameter value. exact_length // Returns FALSE if the form field is not exactly the parameter value. greater_than // Returns FALSE if the form field is less than the parameter value or not numeric. less_than // Returns FALSE if the form field is greater than the parameter value or not numeric. alpha // Returns FALSE if the form field contains anything other than alphabetical characters. alpha_numeric // Returns FALSE if the form field contains anything other than alpha-numeric characters. alpha_dash // Returns FALSE if the field contains anything other than alpha-numeric char...