D7 injecting page body content from a module
Create a menu path and function for it, then in the function: function mypage_callback(){ $content = file_get_contents({path/filename}); return $content; } Jamie Holly http://www.intoxination.net http://www.hollyit.net On 7/7/2011 10:18 AM, jeff@ayendesigns.com wrote:
I have a page that needs to be displayed from a module. In a non-Drupal environment, I'd say I have what is an html file that I need to include... pretty much what would be the node content ($content) and in-line javascript.
I had it in an 'inc' file and just tried including it, but of course that didn't work. I don't have a node in this case, so hook_nodeapi in order to add this content won't work. I'm unsure whether it makes more sense to try to use a template (and if so, which? since it's not a node) or use it as block content and dynamically create the block, but with that I have the issue of how to get it into a variable instead of having it sit in an external file ... I don't see a Drupal function that will allow me to read the entire file as one text blob, though I could use a php function.
participants (2)
-
Jamie Holly -
jeff@ayendesigns.com