What is this (IIFE) construct in javascript?

Immediately-Invoked Function Expression, or shorter: IIFE. It executes immediately after it’s created.
This pattern is often used when trying to avoid polluting the global namespace, because all the variables used in the function are not visible outside its scope. It’s good to use when we have multiple functions with the same name.

<script>
//IIFE Immediately-Invoked Function Expression
var b = ( function(){
        function a(){return 5;}
        return a();
}());   
</script>

<script>
    function a(){return 4;}

console.log(b);
</script>

The output will be 5.

Install and Setup WP Multisite Network

What is WP Multisite?

A WP multisite network allows to run and manage multiple WP sites from a single installation. You can create new websites instantly and manage them using the same username and password. You can even allow other users to signup and create their own blogs on your domain.

To enable Multisite, you need to access your website using an FTP client or cPanel file manager and open wp-config.php file.
Continue reading “Install and Setup WP Multisite Network”

Wamp does not start: Windows 7, 64Bit

1. One solution to fix this problem is the following:

Start > cmd.exe

Inside the Command Prompt (cmd.exe) type:

cd c:/wamp/bin/apache/ApacheX.X.X/bin
httpd.exe -e debug

**Note that the ApacheX.X.X is the version of the Apache wamp is running.

This should output what the apache server is doing. The error that causes Apache from loading should be in there. My problem was that httpd.conf was trying to load a DLL that was missing (icuuc51.dll). As soon as I overwrote this file, I restarted Wamp and everything ran smooth.

2. Other solution is to download vcredist_x86 (Microsoft Visual C++ 2008 x86) from microsoft website.

3. Third option is to click orange icon and hit Apache > Service > Install Service. Click again orange icon and hit Apache > Service > Start Service. Click orange icon and hit Put Online.

Try these methods. I hope this will fix your issue.

Cross domain access to data on the server PHP

If you are doing a ajax call to retrieve data from your own server on a platform which is set to prevent these ajax calls . To bypass “Access-Control-Allow-Origin” you need to allow cross domain access by including this in your server php code.

header('Access-Control-Allow-Origin: *');

OR – for only one domain

header('Access-Control-Allow-Origin: http//your-domain.com');

I hope this will help you gain access to you cross-domain data.

Bootstrap startup template

Hello, I will provide you with basic bootstrap template with great reservation popup.
This template contains:

  • navigation bar with dropdown menu and popup box
  • carousel slider
  • several styles for content
  • fixed footer

Bootstrap is a really fast way to build responsive designs. Once you learn to use it, you will be impressed how good framework Bootstrap is.
Here is the link to -> documentation

Display Recent Posts outside the WordPress

How to import recent post from your internal blog to your website without any difficulties.
First you need to create wp-latest-blogs.php file where you include wp-load.php for your wp blog.

< ?php
    /**
    * WoredPress Latest blog entries
    * @package WordPress
    */
    require( './blog/wp-load.php' );
    // Load the recent top 10 posts
    query_posts( 'posts_per_page=10' );
    ?>
    <div id="blogPosts">
    <ul id="blogList">
    < ?php if (have_posts()) : ?>
    < ?php while (have_posts()) : the_post(); ?>
    <li>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to < ?php the_title_attribute(); ?>">
    < ?php the_title(); ?><span class="date">< ?php the_time('F jS, Y') ?></span></a>
    </li>
    < ?php endwhile; ?>
    < ?php endif; ?>
    </ul>
    </div>

Continue reading “Display Recent Posts outside the WordPress”

HTML5 and all browsers compatibility

Shims, Shivs and Polyfills

Shims and shivs are small libraries that fill gaps in a platform

  • Mainly used when API changes and cause compatibility issues
  • The older API can still be supported by a thin compatibility layer on top of the newer code

Polyfills are similar concept to shims/shivs

  • They provide fallback functionality for features still not implemented natively in the browser
  • When the user update their browser they will have the same experience, but use native implementation

Continue reading “HTML5 and all browsers compatibility”