Getting Started With Symfony 2: Quick Setup

If you are a web developer then you might have heard something called as “Symfony“. So what is this Symfony? Framework? Language? Tool? or something else? Let’s have a quick look on this.

What is Symfony?

Symfony is nothing but a set of reusable PHP components, a web application framework. Symfony is a leading PHP framework, which has a large user base and used to create websites and web applications.

Symfony is basically set of components. Depending on your needs, you can either choose individual component, you can choose set of components or you can go with full framework. Before going to Why Symfony? Let’s first see why you should use a Framework?

Continue reading Getting Started With Symfony 2: Quick Setup

Using CSS Variables

Nice to hear! Variables are finally available in CSS. You can declare variables in CSS with var-* prefix, such as

html{
    var-pri-color: #0090f0;
} 

With above code, we created a variable with name ‘pri-color‘ and it stores ‘#0090f0‘ as value. There is an important condition with CSS variables and that is, you must declare them under CSS-Selectors else they will not work. Since we want to use the variable globally, we nested it under html{} selector.

You can use this variable with var() method as shown in following code

body {  
    background-color: var(pri-color);  
} 

Hence the whole code will be

html{
    var-pri-color: #0090f0;
}
body{
    background-color: var(pri-color);
}

Demo
(You will see blue background in following demo, if your browser supports CSS variables). Click here to load demo on new page.

See the Pen CSS Variables by Ankur (@asmhatre) on CodePen.

How to View your Old Notifications in Android

Lost or dismissed your important notification from your android device? Now you want to get it back?  Well if you are having Android JellyBean or later, you can get back your dismissed notification with few easy steps.

Android Notification History
Android Notification History

Simple go to your android home screen and tap App icon. Switch to Widgets tab, and look for 1×1 Settings Shortcut. Place it on your home screen. Now tap on that newly placed icon and select Notifications from list. That’s all. Tap on it to see all pushed notification history in reverse chronological order.

Image via ibtimes.com and Kārlis Dambrāns

WordPress Hack: Remove Width And Height Attributes From Images

Whenever you upload any image to your WordPress based website, and you use it in your post, automatically WordPress adds Width and Height attributes to all image elements (i.e. in tags).

This is fine in most of the cases, but if you want to stop WordPress from adding those attributes then you can go with this code.
Continue reading WordPress Hack: Remove Width And Height Attributes From Images

Displaying Posts From A Category In WordPress

It may happen that you are designing some sort of archive pages or a front page and you want to list all posts belonging to some specific category. In this case you can go for following code.

<?php
    $idObj = get_category_by_slug('category_slug_here');
    $id = $idObj-&gt;term_id;
    $posts = get_posts('category='.$id.'&amp;orderby=asc&amp;numberposts=10');
    while(have_posts()) {
        the_post();
        /* Do what ever you want with your posts */
    }
?>

One of the best thing about this code is, it lists all the posts from the specified category and if that specified category has child categories, then the code also lists the posts from child categories. That simply means you will have all posts from specified category and its all child category. You have to replace the ‘/* Do what ever you want with your posts */‘ with appropriate code to handle the post listing on the page.