How can i access variable inside body node(input format:php) from my own module please can you help me.

I make own simple module and storing actual variable like this:

.
..
...
function getip_preprocess(&amp;$vars) {
  global $get_specific_ip;
  $vars['get_specific_ip'] = get_client_ip();
}
...
..
.


If i call this variable from page.tpl.php, or node.tpl.php., it works.....

But if im trying to get this variable from inside of body content area, result is empty... If i call function get_client_ip(), i will get solution i need to see, but im trying to get it as a variable, like $user.

I tried to make global variable from it ( $GLOBALS['get_specific_ip']; ) , but it aint works.

Please help me how to do it.

Thanks a lot for your answer.

Regards Stein
Some comments on your code and question:


global $get_specific_ip; and $GLOBALS['get_specific_ip']; are both the same  thing. For more info see http://php.net/manual/en/language.variables.scope.php
global variables and the template $vars array are different, so 
global $get_specific_ip;
$vars['get_specific_ip'] = get_client_ip();
won't actually set a global variable because you're never setting $get_specific_ip to anything, it will only set the $vars['get_specific_ip'] variable, which will make $get_specific_ip available in all your templates but not as a global variable.
The getip_preprocess() does not seem like the best place for this code. IP address is not specific to theme templates and would be best as either a global variable or attached to the existing global $user object. In either case gettip_preprocess() is not the optimal place because it isn't a global solution.
If the function get_client_ip() is a custom function of yours you should name space it to your module to avoid possible conflicts with other functions. For example, call it getip_get_client_ip().
The variable name $get_specific_ip is a little strange because it sounds like an action or function name but it should describe what is stored in it. For example $client_ip. That however could also run into name spacing issues so would be better as $getip_client_ip or something like that.
Note that there is a Drupal function ip_address() that might possibly be useful to you.


If you really want this available everywhere then you could use hook_boot() like this:

/**
 * Implement hook_boot().
 */
function MODULENAME_boot() {
  // Set the user's IP address to a global variable for use elsewhere.
  global $get_specific_ip;
  $get_specific_ip = get_client_ip();
}


Then you can use global $get_specific_ip; from anywhere on the site to get that variable.

The use of hook_boot() means it will run even on cached pages, which is a must for IP detection because you want your code to run and get the current user's IP even if they are getting a cached page.
The other side to that is that you need to be careful to try not to use resource intensive code in there because it will always run on every page load.

It's worth noting at this point that whenever doing something with dynamic data like IP address make sure to properly test cached pages to make sure they always function as you would expect.

One last thing is that Drupal core already makes the user's IP address available to you in the global $user object.

So you can also get the IP like this:

global $user;
$ip = $user-&gt;hostname;


So unless you are doing something special in your get_client_ip() function it might be better to use that.