5

I am creating a page flip for a drupal site using pdf_to_imagefield module to export PDf to JPG and then I need to have the list of JPG files as XML to use them in Dynaimc page flip.

The PDF and all JPOG files for each PDF page are stored in the same node of a certaine content type. How do I output this node as XML where I can control XML tags??

I have tried to create node-content-type.tpl.php but it comes as HTML.

4

I would recommend that you use views as your source for the list of jpegs to output your XML file from. Using Views for example, I was able to make list of event images and make a custom XML file used to display the images in the Cub3r Flash plugin (I thought it was a bad idea but the client really wanted a Flash slideshow). I used the Views Bonus Pack export module, that gave me a style 'XML file'. I had only the image field, that was set to output the full image URL, the label I set it to was used as the custom tag. I then did an override of the XML template that came with the module and customized it to my needs (adding config parameters to cub3r).

Hopefully this will help you out. I also saw that the export module now has a fork that uses the batch API. Make sure you also checkout the Views data source module.

  • yes that's really helping..thks – Mika A. Oct 14 '11 at 14:42
3

You can make a hook_menu entry for your XML URL w/ a callback function.

The callback function can do a

drupal_set_header("Content-Type: text/xml; charset=utf-8");

// stuff to make the xml;

print $xml;

exit;

You can also do it with views, but I forget the steps to do this. There are a bunch of tutorials on the net, though, that outline this method, and likely some questions/answers on the main SO site.

2

I have solved it by creating a module, which generates an xml-file when you update your node. I used hook_update to hook into the update progress, check if the images have been updated and create / update the config.xml which I store in the directory of the images. this way you dont need to generate the xml file each time a user views the node.

You have to create a template for generating the xml-files, passing your image-datasetting the configurations and than save the themed content into the config.xml.

hope I could help

  • This would mean that the XML file would bypass any permissions that may be in place on the node. – mpdonadio Oct 13 '11 at 17:15
  • you wont parse the XML file if the node is not being viewed. but if there is need to protect the cfg-file you can still save the file in the private folder, create a path for xmlfile generation in your module where you can check the permissions and embed this generation path with the parameters you need (node, user etc) – anonym-developer Oct 14 '11 at 8:40

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.