Thursday, 24 August 2023

125 Useful vs code extensions to develop laravel application

 DotENV

EditorConfig for VS Code

Laravel Artisan

Laravel Assist

Laravel Blade formatter

Laravel Blade Snippets

Laravel Blade Wrapper

Laravel Create View

Laravel Extension Pack

Laravel Extra Intellisense

Laravel goto view

laravel intellisense

Laravel Snippets

laravel-goto-components

laravel-jump-controller

PHP Intelephense


Wednesday, 12 July 2023

124.Useful auto complete extensions of vs code

 1. .env

.env extension-> variable name in blue in env file

2.Laravel Extra Intellisense

laravel extra intellesense package->get complete view files in route('') and view('')

return redirect()->route('');


3.PHP Intelephense(elephant icon) ->to get namespace of model automatically and add in top of the file

Eg: type $user=User enter key(get use App\Models\Entry; name space in top of controller page)

4.laravel extension pack

to get syntax of foreach(seclect :b),for,switch,if

support blade commenting system 

ctrl+/->({{-- --}})

5.laravel intellisense

to get columns in db table

$users=User::where('')->get all columns in user table

6.laravel blade snippets

html auto complete


.row+enter key

<div class="row"></div>


#row+enter key

<div id="row"></div>


html:5(to get html structure)

Eg:


<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta http-equiv="X-UA-Compatible" content="ie=edge">

    <title>Document</title>

</head>

<body>

    

</body>

</html>


select>option+enter key

select>option*5+enter key

<select name="" id="">

<option value=""></option>

</select>


ul>li*10

ul.row>li*10

7.laravel assists(blue backround icon)


Tuesday, 26 October 2021

123.pagination and load more in wordpress

  <section class="ftco-section bg-light">

      <div class="container">
        <div class="row">
          <?php
         
            $wpb_all_query = new WP_Query( array(
            // 'posts_per_page' => 6,
            'post_type'=>'post', 'post_status'=>'publish',
            'paged' => get_query_var('paged') ? get_query_var('paged') : 1) );


          if ( $wpb_all_query->have_posts() ) :
            while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post();
     
      $imag_url= get_the_post_thumbnail_url();    
          ?>  
          <div class="col-md-4 ftco-animate life-style">
            <div class="blog-entry">
              <span href="#" class="block-20" style="background-image: url(<?php echo $imag_url; ?>);"></span>
              <div class="text pt-3 pb-4 px-4">
                <div class="meta">                
                  <div><span class="life_style_text"><?php the_title(); ?></span></div>                  
                </div>
                <h3 class="heading"><a href="#" ><?php the_content(); ?></a></h3>
                <p class="clearfix">
                <?php the_content(); ?>
                </p>
              </div>
            </div>
          </div>
          <?php endwhile; ?>
      <?php else:?>
     
        no post found
   
      <?php endif; wp_reset_postdata(); ?>
         
         
        </div>
       
        <?php /*
          <div class="row no-gutters my-5 ">
          <div class="col text-center">
            <div class="block-27">
            <div style="clear:both;">
            <ul>
           
            <li>
            <?php
           
            $big = 999999999; // need an unlikely integer
            echo paginate_links( array(
                'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
                'format' => '?paged=%#%',
                'current' => max( 1, get_query_var('paged') ),
                'total' => $wpb_all_query->max_num_pages
            ) );
           
            wp_reset_postdata(); ?>
            </li>
           
            </ul>
            </div>              
            </div>
          </div>
          </div>
          */?>
         
          <div class="form-group text-center">
          <a href="" class="load-more" id="seeMore">Load More</a>
          </div>
         



      </div>
    </section>




<script>
  $(document).ready(function(){
  $(".life-style").slice(0,6).show();
  $("#seeMore").click(function(e){
    e.preventDefault();
    $(".life-style:hidden").slice(0,6).fadeIn("slow");
   
    if($(".life-style:hidden").length == 0){
       $("#seeMore").fadeOut("slow");
      }
  });
})
  </script>

Friday, 9 July 2021

122.adding tag and category of a post in a custom post tyle

a .     tag and category                      

   'taxonomies' => array('category', 'post_tag')

b . tag

            'taxonomies' => array('post_tag')

121.tags in wordpress

 add_action( 'init', 'create_topics_nonhierarchical_taxonomy', 0 );

 
function create_topics_nonhierarchical_taxonomy() {
 
// Labels part for the GUI
 
  $labels = array(
    'name' => _x( 'Tags', 'taxonomy general name' ),
    'singular_name' => _x( 'Tag', 'taxonomy singular name' ),
    'search_items' =>  __( 'Search Tag' ),
    'popular_items' => __( 'Popular Tag' ),
    'all_items' => __( 'All Tags' ),
    'parent_item' => null,
    'parent_item_colon' => null,
    'edit_item' => __( 'Edit Tag' ), 
    'update_item' => __( 'Update Tag' ),
    'add_new_item' => __( 'Add New Tag' ),
    'new_item_name' => __( 'New Tag Name' ),
    'separate_items_with_commas' => __( 'Separate tag with commas' ),
    'add_or_remove_items' => __( 'Add or remove tag' ),
    'choose_from_most_used' => __( 'Choose from the most used tags' ),
    'menu_name' => __( 'Tag' ),
  ); 
 
// Now register the non-hierarchical taxonomy like tag
 
  register_taxonomy('topics','cities',array(
    'hierarchical' => false,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'update_count_callback' => '_update_post_term_count',
    'query_var' => true,
    'rewrite' => array( 'slug' => 'topic' ),
  ));
}

Thursday, 8 July 2021

120.disable the block editor only for particular post types

 add_filter('use_block_editor_for_post_type', 'prefix_disable_gutenberg', 10, 2);

function prefix_disable_gutenberg($current_status, $post_type)
{
    // Use your post type key instead of 'product'
    if ($post_type === 'cities') return false;
    return $current_status;
}

Saturday, 6 February 2021

 119.how to append html contents in popup in codeigniter using jquery

above footer


<!-- send modal -->
<div class="modal fade" id="privi_popup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
            
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Privilege Card</h4>
                </div>
            
                <div class="modal-body" id="priv_body">
                    

                </div>
                
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>    
                </div>
            </div>
        </div>
    </div>
<!-- end delete modal -->

js
$("#privilege_card").change(function(){
                 
                  var barcode_id    =  $('#privilege_card').val();

                  $('#privi_popup').modal('show');

                  $.ajax({         
                     
                     url      : "<?php echo base_url(); ?>" + "User/privilege_card_popup",
                     data     : {barcode_id:barcode_id},
                     dataType : 'html',
                     type     : 'POST',      
                  
                     success: function (data) {
        
                          $("#priv_body").html(data);
                         // alert(data.result);
                      
                     },
                     error: function() {
                        alert('Something is wrong');
                     },
                   
                  });
 });


    public function privilege_card_popup()
    {       
        $barcode = $this->input->post('barcode_id');

        $user_id = ltrim($barcode'0');

        $this->load->model('Model_users');
        
        $user_details['user']       =   $this->Model_users->get_user_org_details($user_id);

         $user_details['barcode']    =  "".base_url()."application/libraries/barcode/barcode_new.php?codetype=Code128&size=40&text=$barcode&print=true";

        $this->db->select("*");

        $this->db->from('tb_admin_settings');

        $settings                    =  $this->db->get()->row();

        $user_details['settings']    =  $settings;
        
        $this->load->view('pages/theme-bc1',$user_details);
        
    }