I have a module that creates a simple page. However in the page I want to link to iframes that I will generate in the module code.
Currently I have two hook_menu items: one for the simple page (no arguments), one for the iframe pages (with arguments).
However when I show the iframe, I need to get some values from a global variable that is populated from the simple page function but when I reference it in my function for the pages with arguments the variables are always null. I assume this is because drupal re-loads the .module page but skips running the simple page function when it loads the page with arguments, thus it doesn't populate the variables when it loads the iframe.
How could I populate my iframe with the variables from my simple page? Is there an easier way than what I'm doing? Can I do it without global?
Does that make sense?
function my_custom_page() {}
for:
drupal/my-custom-page-module
function my_iframe($id) {}
for:
drupal/my-custom-page-iframe/0
Code for drupal/my-custom-page-iframe/0
needs to get variables that were generated in function my_custom_page() {}
when it runs the my_iframe($id)
for the page callback.
I have defined the variables outside functions as global and included global var_name in both functions but it still doesn't work.
Also, the iframe should not have any Drupal theme/sidebar content: for this I'm just echo'ing my code and then return: within my_iframe{$id}
.
What I was thinking was instead of using two functions with page callback, was to just use GET request for my 'iframes' like ?iframe={$id}. Does that sound like a better direction to go?