In this example, I have shared how to displaying a Drupal view without a page template around it.I was looking for a way to pull node data via ajax and came up with the following solution for Drupal 6. After implementing the changes below, if you add ajax=1 in the URL (e.g. mysite.com/node/1?ajax=1), you’ll get just the content and no page layout.
Add the below code in your template.php file
for your theme:
1 2 3 4 5 6 7 | function phptemplate_preprocess_page(&$vars) { if ( isset($_GET['ajax']) && $_GET['ajax'] == 1 ) { $vars['template_file'] = 'page-ajax'; } } |
Then create page-ajax.tpl.php file
in your theme directory with this content:
1 | <?php print $content; ?> |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.