Embed a view inside a node in Drupal 7

We can embed a view created by Views module inside a node in Drupal 7 with just some short code. Here is the code:

<?php
    $view = views_get_view('your_view_name');
    $view->set_display('your_view_display_name');
    $output = $view->preview();
    // now print the view.
    if ($view->result) {
        print views_embed_view('your_view_name', $display_id = 'your_view_display_name');
    }
?>

Just put that in your node.tpl.php, and don't forget to change the views name and display name with yours.

Top Ten Free Professional Drupal Themes

Drupal has an amazing and clean code. Support of social networking, multimedia, SSL, event calenders, document management, blogging, forums, internationalization, user management and permission features, the ease of developing, ease of external integration, complex web sites, and the quality of add-ons for enhancing functionality. Yes Drupal is for the Geeks :)

Drupal has a power, stability and performance but not a good looking, it's hard to find a nice free themes for Drupal. Good looking is one of Drupal limitations, but this days lots web designer start to try out Drupal because the excellent usability improvements from Drupal.

Just switch to using Disqus

Previously I was using Blogger default commenting system, and recently I decided to switch using Disqus. I did this in order to have more organized comments, and it seems Disqus protection from spammers are also much better.

Previously I remove all of the comments, a lot of comments are just spam, so this is a perfect moment to put up new platform for this blog commenting system.

No significant change in the loading speed of this blog, and I think this is the best solution I have now.

Creating custom user login page in Drupal 7

Maybe sometimes we want a custom style for our Drupal login page, different with the existing default login page in Drupal 7, whether it's for a personal project or client requests.

Here is the simplest way to create a custom login page in Drupal 7.

First open the template.php and add the following code:

function yourthemename_theme() {
  $items = array();
  // create custom user-login.tpl.php
  $items['user_login'] = array(
  'render element' => 'form',
  'path' => drupal_get_path('theme', 'yourthemename') . '/templates',
  'template' => 'user-login',
  'preprocess functions' => array(
  'yourthemename_preprocess_user_login'
  ),
 );
return $items;
}

create a new folder "templates" and than creating user-login.tpl.php file and place it inside.

Open the user-login.tpl.php file and paste the following code:

<?php 
  print drupal_render($form['name']);
  print drupal_render($form['pass']);
  print drupal_render($form['form_build_id']);
  print drupal_render($form['form_id']);
  print drupal_render($form['actions']);
?>

add the wrapper such as div, span, etc. to test it. Don't forget to clear your Drupal cache.

Happy new year 2013

Happy new year 2013 everyone. Hopefully this year will be better than last year, we will strive to improve the quality of every aspect of our lives, we can do it.

This is the fifth year for this blog, a certain satisfaction when looking at to the archive pages. Thanks for your supports.