Skip to main content

Welcome to Key2Goal

It's a Tech Blog
hero-image
techoptions-img

Blog Posts

techoptions-img
Other

Social media apps like Facebook, twitter linked allow your website and apps to share on there pages to reach with more peoples.

Question is how to check your post will be look liked on Facebook and other social media website, answer is here, below some links helps you to give virtual look how your page look if share 

Facebook

https://developers.facebook.com/tools/debug/sharing/

Twitter

techoptions-img
Other

For different reason we need the different format of certificates for different operating system, many of sites offering you to convert the certificates in different format online but if you have basic knowledge of command then you can do it by own by just typing simple commands

Firstly you need to installed the openssl on to your machine, see here how to install openssl for linux and centos.

techoptions-img
Drupal

If you want to render a node in drupal 7 it is pretty easy, you just a node id or nid of node for doing this:

simply

<?php 
$nid = 13; //use your node nid which you want to render
$nodeview = node_view(node_load($nid));
print drupal_render($nodeview);
?>

You can use this any template like node,page, block, region or field etc.

techoptions-img
Java

1)Install Oracle Java 8 

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

2) set default java version

sudo apt-get install oracle-java8-set-default

3) Verify java Installation

java -version

Result:

techoptions-img
PHP

Array

Many Helpful Function are available to exact the specific set of keys of an array

$sliced-arr = array_slice($new_tags, 0, 6);

The above code slice the array form keys 0 to 6, So you have 6 entries in the New array.

You can use it according to the need.Further you can used following links to see more examples

techoptions-img
Drupal

In Drupal 8 Twig templates give extra power to drupal to add dynamic content in twig style, In this tutorial we can see how we can add the custom menu classes to menu ul li using menu.html.twig.

If you are creating your own theme or custom theme in drupal 8 then to overwrite the menu class we need to override the menu.html.twig template to our theme directory, so copy menu.html.twig form drupal core template to our theme directory

Core template path: [drupal_root]/core/modules/system/templates/menu.html.twig

techoptions-img
Drupal

Drupal 8 use its own jquery version by default and if you want to use the other version of jQuery instead of default than this tutorials steps is for you, sometimes we need different version to other plugins and libraries to work if you are using external libraries or something like that . Follow the steps 

1) we need to create the "libraries-override"  attribute in yourtheme.info.yml

libraries-override:
  core/jquery: yourtheme/jquery-custom

2) Second download and placed your js file in theme folder like example:

techoptions-img
Drupal

Drupal Views

Import and Export configuration is the basic protocol to staging the website or production website deployment, In Drupal 7, we need the extra modules to import and export or we can use features modules to do so.

But In the drupal 8 that settings / configuration can we imported directly from the core system, Drupal 8 provide the system in core functionality, if you want to do this kind of stuff, please follow this tutorial.

In this tutorial we can see how to import and export a view, you can do full configuration also, so lets start

techoptions-img
Wordpress

Hey,

This is error caused by php7 and later,many application will face this error Reason behind is that the php 7 will not convert the blank variable with is define as string to array:

Suppose you define a variable like below code and later you use it as array, then this error come in the picture:

$object = "";

for($x > 1){

$object[] = $x;

}

form above example you defne the $object to blank varible and later you use it as array that why you will face the error.

techoptions-img
CSS

Flexslider uses the arrows of its own flexslider family icons, if you want to change or replace with yours images you can do using following css.

techoptions-img
Other

Find is best command to apply permission to directories and files recursively to all .

For Directories

find /desired_location -type d -print0 | xargs -0 chmod 0755

For Files

find /desired_location -type f -print0 | xargs -0 chmod 0644

 

techoptions-img
MySQL

As we all know the xampp is most popular tool at machine level programming work, but sometime we need to deal with the bigger databases to import into mysql of xampp that provide and we import that using user interface then we will fail or not properly imported, I personally faced that issue many times so I just use the command prompt, because it is fastest way to do any task in any any operating systems.

For Importing database using xampp mysql, just follow the simple steps below, its quiet easy to do -

techoptions-img
MySQL

we can create the database views for many reason, but if we forget what query you was used to create the views or need to find out using which query results are generating here is the solution:

Below are the simple query to run and you will get the query:

SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_NAME = 'yourviewname'

instead of 'yourviewname',type your views name to get the result.

techoptions-img
Other

Usually we develop the site on developement or subdomain and when we finally mirgate the to new domain then some of thing will remain or page redirect happens in  sometimes , so In this case .htaccess file helps to redirect all your olddomain pages to new one 

Below is the code will helps to redirect the olddomain to new domain, should be written in .htaccess file on your root folder

techoptions-img
Javascipt

If you want to prevent the form submit using jquery, then this page helps you to doing this.

jQuery(document).ready(function() {
                jQuery(window).keydown(function(event) {
                    if (event.keyCode == 13) {
                        event.preventDefault();
                        return false;
                    }
                });
            });

 

techoptions-img
Drupal
function HOOK_preprocess_page(&$vars) {
global $user;
  if (!in_array('administrator', $user->roles) && variable_get('maintenance_mode') == 1 && arg(0) != 'user') {
    $vars['theme_hook_suggestions'][] = 'maintenance_page';
  }
  else if (drupal_is_front_page()) {
    $vars['theme_hook_suggestions'][] = 'page__front';
  }
}

 

techoptions-img
CSS

hey Guys,

In this tutorial, we are showing you how to display a child div on hover on parent div having multiples section over that page, as we all know javascript can made easy and use for this browser end purpose, but if you want to do it with pure css then this follow the tutorial

We are using codepen for display, you can visit site for full view or just use below snippet

 

 

techoptions-img
Drupal

Drupal provided the lots of hook to extents its functionality, using this we can prevent a js file to load on particular page using HOOK_JS_ALTER

If you want to load a js on every page except some page, below example will help you to achieving this.

techoptions-img
PHP

By Follow steps below, you can find the api key or create the api key at mailchimp and use it to your website to connected the site with mailchimp to collect the subscribe in fastest way.

  1. Login to Mailchimp account 
  2. On upper right side MY ACCOUNT >> Profile, click on profile link
  3. On Profile Page, under Extra >> API Keys
  4. Create API Key and a New API will generated or you can find your old keys here.

Below steps with images:

2)

techoptions-img
PHP

Mailchimp is marketing automation platform and is provide email for marketing your product or business whatever you like, today its most trusted service providing all over the globe. It is also provided the some service that connected your website and perform peoples to your website.

Today we are writing this to those who want to find list id in our Mailchimp account, because on login there are many services provided, with this tutorial you can easily find that, so let start in steps.

1) Login to your mailchimp account form the login page.