Overriding page.tpl.php from module

asund - May 11, 2008 - 21:04

Hi!
I'm making my first module - it parses drupal nodes to xml for flash interfacing.
My problem is:

I'm making a page with hook_menu, but i don't want the page to include drupal templates like page.tpl.php. I want it to render the page as xml and need it to start th page with

$xml_header='<?xml version="1.0" encoding="UTF-8"?>';
header('Content-type: text/xml');
print $xml_header;

I can do this by altering på page.tpl.php, but I would like my module to do this automatically.
How? :)

maybe i should be more

asund - May 11, 2008 - 21:14

maybe i should be more clear:

I'm making the page /xml_parser with hook_menu in my module.
I want drupal to drop the page.tpl.php when on this path (or use another template file in the module directory).
I don't want to have to change to theme templates to do this.. :)

How are you planning to invoke these?

MikeSchinkel - May 12, 2008 - 04:31

If you are using hook_menu, you specify what function is called and in that function you don't have to call the functions that ultimate call page.tpl.php. Or maybe I'm missing something?

Can you give some more details on what you are trying to accomplish complete with example URLs and what you want them to do, and why?

if i use print $output; in

asund - May 12, 2008 - 12:17

if i use print $output; in stead of return $output; it overrides the template, but is that good practice?

That's not what I was

MikeSchinkel - May 13, 2008 - 11:07

That's not what I was asking.

What is your business use-case?

What are your URLs that you plan to use?

Do you want an XML URL for each content node, or something else?

I guess I don't understand what you are trying to do and I need to understand to offer help.

DUPLICATE POST

MikeSchinkel - May 13, 2008 - 11:07

DUPLICATE POST

 
 

Drupal is a registered trademark of Dries Buytaert.