Monday, April 19, 2010

Get full url with http or https protocol


/**
*
* @get the full url of page
*
* @return string
*
*/
function getAddress()
{
/*** check for https ***/
$protocol = $_SERVER['HTTPS'] == 'on' ? 'https' : 'http';
/*** return the full address ***/
return $protocol.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
}

/*** example usage ***/
echo getAddress();

?>

Drupal Front Page with multiple views content

I have posted one topic regarding how to load the multiple views in to single page ie:page-front.tpl.php .
In this example you have to create view name Mobile_applications and with in this view you have to create two page views those ids page_1 and page_2.

Now you can call those views using the fallowing code in page.tpl.php
//This is used to display the view in a page
$viewName = 'Mobile_applications';
$output = views_embed_view($viewName,'page_1');
echo "

Applications for your phone

";
print $output;

$output1 = views_embed_view($viewName,'page_2');
echo "

Top rated

";
print $output1;

?>