Thursday, August 25, 2011

Site Leaving Pop Up Using Drupal

Site Leaving Popup Using Drupal:

At first we need to Define a Menu Callback in your module File,
$items['site_leaving'] = array(
    'page callback' => 'site_leaving',
    'access callback' => TRUE,
    'type' => MENU_CALLBACK,

Next,We need to create that call back function,

function site_leaving(){
    return true;

Then all the works in the TPL file,Create a tpl file in the name of page-site_leaving.tpl.php in your themes folder,

<!--Main Wrapper Begins-->

<link rel="stylesheet" type="text/css" href="<?php print base_path().drupal_get_path('theme','your theme name');?>/css/site_leaving.css" />

<script language="JavaScript" type="text/javascript">
function createWindow() {
var URL = '';
var windowName = 'Leaving'; (URL, windowName, "toolbar,resizable,width=800,height=500");

<div style="width: 420px; height: 200px; margin: -8px 0 0 -8px; ">
<table cellspacing="0" bgcolor="#ffffcc" border="0" cellpadding="0" width="420" style="height:200px;">
<td style="padding: 15px 10px 10px;">
<p><strong><span class="exitHeaderText"><b>You are now leaving our site.</b></span><br />
</strong>This link will take you to a Web site to which this <a href="#" onclick="javascript:window.opener.location.href='<?php print base_path();?>privacy_policy'">Privacy Policy</a> does not apply. We encourage you to read the Privacy Policy of every Web site you visit.
<br />
<br />
<br />
<a href="javascript:createWindow();" onclick="createWindow(); return false;">Continue</a><br />
<br />
<a href="javascript:window.close();">Cancel</a></p>
<!--Main Wrapper Ends-->

Then add a css file in the name of site-leaving.css with your favourite styles,,,
That's It,,,

No comments:

Post a Comment