Next Tutorial

Drupal 7 Tutorial Part 16: Drupal 7 Reports & Logs Explained

How to verify current page is Front page in Drupal using code

Submitted by anilsagar on Mon, 10/17/2011 - 12:31

Hi Drupalers,

Call function drupal_is_front_page() function in drupal to determine current page is home page or any other page.

If it returns true then it is front page, else you are in some other page other than front page / home page.

 

<?php

$flag = drupal_is_front_page();

if ($flag) {

  drupal_set_message("Welcome to front page of this site.");

else {

   drupal_set_message("Now you are in page other than front page.");

}

?>

0 comments

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image. Ignore spaces and be careful about upper and lower case.
©2010 AnilSagar. All rights reserved. Drupal theme by Kiwi Themes.