Ward
Ward

Reputation: 3318

Drupal - Template for Custom Page

I've got a custom page I created programmatically using hook_menu. I can have it return content without a problem. However, I want it to appear within the content region of my page.tpl.php template so that blocks can be incorporated in the page. Same way that Views allows you to give a view a custom url while still appearing in the page.tpl.php template.

How do I do this for my page? By default, I just get a with only my content.

Thanks, Howie

Upvotes: 1

Views: 364

Answers (1)

Karl Bielefeldt
Karl Bielefeldt

Reputation: 49148

In your page callback function, if you just print the content of your page without returning anything, it won't be included within your page.tpl.php. If you return a string containing the contents of your page, it will go into the content region, i.e.

function mymodule_page_callback () {
   $content = "Hello, world inside the content region";
   return $content;
}

Upvotes: 2

Related Questions