By asund on
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? :)
Comments
maybe i should be more
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?
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
if i use
print $output;in stead ofreturn $output;it overrides the template, but is that good practice?That's not what I was
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
DUPLICATE POST
I just had a similar problem.
I just had a similar problem. I wanted to create a template with just html markup, and not have it run through the default page.tpl.php. Here is what I did in my module:
And then I created a page template called page-my-special-page.tpl.php in the mymodule folder. The code in mymodule_theme_registry_alter adds your module path to the top of the suggested files. By naming your template page-something.tpl.php you are overriding the default page.tpl.php.
I hope that helps!