So I have created a custom module for Drupal 6.x and it works as I can see the desired results in the page.tpl.php page, but when I edit a page from the GUI (it allows php tags) the object is not accessible.
I can set the values in a SESSION which I can access from the GUI as well as the module but is this the correct way to do this?
Here is the error I get:
Fatal error: Call to a member function getEmail() on a non-object in /var/www/domain/includes/common.inc(1695) : eval()'d code on line 221
Call Stack
# Time Memory Function Location
1 0.0003 64108 {main}( ) ../index.php:0
2 0.0965 11659504 menu_execute_active_handler( ) ../index.php:18
3 0.1040 12626908 call_user_func_array ( ) ../menu.inc:348
4 0.1040 12627316 node_page_view( ) ../menu.inc:0
5 0.1040 12627532 node_show( ) ../node.module:1797
6 0.1040 12627848 node_view( ) ../node.module:1101
7 0.1040 12628192 node_build_content( ) ../node.module:1006
8 0.1041 12648832 node_prepare( ) ../node.module:1085
9 0.1041 12649112 check_markup( ) ../node.module:1041
10 0.1047 12671980 module_invoke( ) ../filter.module:457
11 0.1047 12693240 call_user_func_array ( ) ../module.inc:462
12 0.1047 12693900 php_filter( ) ../module.inc:0
13 0.1048 12694164 drupal_eval( ) ../php.module:82
14 0.1059 12883728 eval( ''?>
getEmail() is a function in a class that is in my custom module. I can call it from the page.tpl.php just fine, so why can't I call it from a page that I have edited in the Admin GUI?
EDIT:
Adding Code from Module:
//wrapperFunction() is calling the class and setting the values
// this is just a getter/setter class w/ 1 function that formats a phone number, nothing special
$custom = new CustomObj();
$custom->setEmail('blah@blah,com');
return $custom;
page.tpl.php
// calls the wrapper function and returns the object
$custom_obj = wrapperFunction();
echo $custom_obj->getEmail(); // this prints the email just fine
Edit page through the Admin GUI (Allows PHP tags) Adding this code to the page
<?php echo $custom_obj->getEmail(); ?> // throws the error
Sorry this is my first Drupal Module so any insight would be great as I'm also new to using Drupal, sigh...