I have a drupal 7 instance where I would like to create nodes that call reports from a separate site using javascript.

Currently I construct the HTML tags myself which look something like this:

<script type="text/javascript" src="http://URL.goes.here/JsAPI?reportUUID=[REPORTID]&amp;yfFiltera5d74aca-4396-41c2-9376-d68fd57de81a=[FILTERVALUE]&display=[DISPLAY]&canChangeDisplay=[CANCHANGEVALUE]&showPageLinks=[SHOWPAGESVALUE]&showInfo=[SHOWINFOVALUE]&showFilters=[SHOWFILTERSVALUE]&showSections=[SHOWSECTIONSVALUE]"></script>

Note that there are a bunch of parameters in the url shown in square brackets: [VALUE]

What I want to do is have a node creation interface for admin users that allows them to set all of the parameter values and constructs that URL, then constructs a string using those parameters and uses it as the node's output when viewed.

I haven't been able to find any kind of module for this, maybe I am describing it wrong - or maybe it's a very rare use-case. Any ideas would be wonderful, even if it's 'hire a developer, this has never been done before'.

  • Well there's definitely no module for it. Does it need to be in the head tag?
    – SDMulroy
    Jul 3, 2014 at 5:12
  • Nope, just in the body (with filters turned off) as I want to be an integral part of the page. A friend has offered to help, I may use this as a project to learn how to make modules, though I don't know how often it would be used.
    – Darvanen
    Jul 3, 2014 at 5:28

1 Answer 1


You can do this in a node.tpl.php file in your theme or to be specific to one content type.

Duplicate the default node.tpl.php file found in /modules/node/ and rename it to node-NODETYPE.tpl.php NODETYPE being the machine name of the node which you can find at structure -> content types, in the CMS.

Install the devel module and enable it, then do a dpm($node); in your copied node.tpl.php file to get the variables you need. Of course you would need to have a custom theme so it doesn't get overridden on an update.

To do this in a module you'd need be somewhat familiar with hooks.

And since the dpm is called after the output is rendered you need to reload the page twice. Don't forget to clear cache after you add in the node.tpl.php to your theme.

  • Thanks that's very helpful! I can't upvote yet, but I will hold off 'accepting' the answer until I've seen it work.
    – Darvanen
    Jul 3, 2014 at 5:48
  • Thanks for the edit. And thanks Darvenen. Just add a comment if you need some more help but really this is a well documented process "getting node values in node.tpl.php"
    – SDMulroy
    Jul 3, 2014 at 10:36
  • I'm halfway there - I only stopped because my work day ended =) So far the advice has been very sound.
    – Darvanen
    Jul 3, 2014 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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