Craig McCoy

Programmer / Developer & Zombie Survivalist

Drupal

Drupal: Make AJAX Calls To Pages & Module Paths

Unpublished
Mar/2011 18

A really simple and easy way to modify your theme page.tpl file to handle ajax calls is to:

1. Above the first output in the page.tpl file (doctype declaration) Add the following code:

[cc lang="php"]
if(!isSet($_GET["ajax"]) && !isSet($_POST["ajax"])) {
[/cc]

2. At the very end of the page.tpl file, add the following code:

[cc lang="php"]
} else {
print $content;
}
[/cc]

Usage:

Pages

Subscribe to RSS - Drupal