so I wanted to remove some of my code from a module and put it in another php file and include it in the main module file like this include('file.php?foo=bar'); so I can pass a variable named foo into file.php

when I try this I get a No such file or directory warning, but when I change it to: include('file.php'); it's works fine but then obviously there's no variable getting passed

it seems that Drupal won't let the module use a url query string for some reason, is there any way around this?

Comments

nevets’s picture

include is part of php, not drupal. A couple of ways to do what you want.

What I would say is the prefered way is to use function in the included file (it sounds like you are including a script). The in the module file you can call the function(s) as needed (after including the file) passing arguments to the function(s).

You can of course use a global variable setting it the module code and then including the file.

ekitel’s picture

my mistake, I guess url query strings are only for url's as the name would imply....