• Angular

    Can’t bind to ‘ngmodel’ since it isn’t a known property of ‘input’. angular 8

    Error in angular at console gives can’t bind to ‘ngmodel’ since it isn’t a known property of ‘input’. angular 8 in xyz.component .html code must be like mind the code : [(ngModel)]=”category” In app.module.ts there must be added FormsModule. import { FormsModule } from ‘@angular/forms’; imports: [ FormsModule]

  • Wordpress

    how to count the hit of post

    Count the post hit and save it to the database Create a database table with fields postid, numberofcounts… logic onload of the post page , get its id and store it in the datatable with count On every load the count number will be increased Example Let us consider the table name is tb_hit_count with field postid , and numbercount if the post_id is already in the table , we just update the count , else we insert the post_it values in table.

  • Wordpress

    Get the parent category of post in wordpress

    get current post id $id = get_the_ID(); echo $id; get current post parent category slug $category = get_the_category(); $category_parent_id = $category[0]->category_parent; if ( $category_parent_id != 0 ) { $category_parent = get_term( $category_parent_id, ‘category’ ); $cat_parent_slug = $category_parent->slug; } else { $cat_parent _slug = $category[0]->slug; }

  • Angular

    Initial Angular Basic Comands

    The initial Angular how to points to remember. How to create new workspace in angular ? *** angular project with folder / project name nameofproject ng new nameofproject this will be done after installing node in your system , and in command prompt(CMD ) getting to the folder where you want to install angular. How to start angular project ? *** component for a specific part work go to CMD editor , type the path where file exists and type command ng serve ** like c:/abc/nameofproject its the path now you will write ng serve. How to create new component in angular ? *** component for a specific part work…

  • magento

    magento 1.9 get parent category of category & attribute set name

    get the name of parent category $abc = Mage::registry(‘current_category’)->getName(); $_category = Mage::getResourceModel(‘catalog/category_collection’) ->addFieldToFilter(‘name’, $abc) ->getFirstItem(); $categoryId = $_category->getId(); $categoryle = Mage::getModel(‘catalog/category’)->load($categoryId); $catnames = array(); foreach ($categoryle->getParentCategories() as $parent) { $catnames[] = $parent->getName(); } Get attribute set name of the product by id $productle = Mage::registry(‘current_product’); $prodid = $productle->getId(); $attributeSetModel = Mage::getModel(“eav/entity_attribute_set”); $sess_product = Mage::getModel(‘catalog/product’)->load($prodid); $attributeSetModel->load($sess_product->getAttributeSetId()); $attributeSetName = $attributeSetModel->getAttributeSetName();

  • Wordpress

    Run wordpress in subfolder of domain

    To run the website as blog in subfolder of domain i.e www.example.com/blog you need to change .htaccess . Normal .htaccess file is as follows # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] # END WordPress you have to change few line here i.e. folder name where the wordpress files lies in eg. blog folder # BEGIN WordPress RewriteEngine On RewriteBase /blog RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] # END WordPress

  • Wordpress

    Set cookies in wordpress

    set cookies in wordpress to pop msg if new visitor . in function.php write the code below : function bloggolfoy_set_new_user_cookie() { if ( ! is_admin() && ! isset( $_COOKIE[‘bloggolfoy_new_visitor’] ) ) { setcookie( ‘bloggolfoy_new_visitor’, 1, time() + 3600 * 24 * 10, COOKIEPATH, COOKIE_DOMAIN, false ); } } add_action( ‘init’, ‘bloggolfoy_set_new_user_cookie’); now where you have coded popup : write <?php if ( isset( $_COOKIE[‘bloggolfoy_new_visitor’] ) ) { // echo ‘Welcome back!’; } else {?> script code to pop <?php } ?>

  • javascript,  laravel,  mysql,  php

    Laravel-date format variable SQL query for API value

    given date value in string format , getting error in SQL query , so have to change it into date format in Laravel using Carbon function ( for date time ) laravel controller sample work to get values in json [RestAPI] Carbon function $users = DB::table(‘abctable’) ->select(DB::raw(‘count(*) as count, city’)) ->join(‘n3d_sales_flat_order_address’, ‘abctable.entity_id’, ‘=’, ‘xyztable.parent_id’) ->whereBetween(‘abctable.created_at’,[new Carbon($fdate),new Carbon($gdate)]) ->groupBy(‘xyztable.city’) ->get();