How to load only content in a page (exclude header & footer) from once specific drupal site to another non-drupal site page.

Like, if I click on link on non-drupal site it should open up drupal content of respective link page without header and footer in a new popup.

I know Iframe and webservice are options to do.

Is there any other way to load content for specific page in drupal to non-drupal site ? Thanks in advance.


You could create a custom HTML template that would remove the HTML tags but that would render on a certain URL. However, that would make that URL every time it rendered. Web services are your best bet rendering the information an XML format. Below is the services module for Drupal 7



In your theme's page.tpl.php, you could do this.

<?php if (isset($_GET['embed'])) {
    print render($page['content']);
} ?>

<?php (!isset($_GET['embed'])): ?>

    the contents of your page.tpl.php file

<?php endif; ?>

That means you can add ?embed=true (or just ?embed) to a url and only the content blocks / node etc. will show.

I do similar to this for some node edit forms that I load in an iFrame inside a modal, like below.

// just an example file path.


if (isset($_GET['modal'])) {
    print render($page['content']);
} else {
    include(drupal_get_path('theme', 'mytheme').'/page.tpl.php');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.