php variables and apPHP tabs. URGENT HELP!!

Discuss everything related to ApPHP Tabs. Any questions related to the ApPHP Tabs developing or using should be posted to this forum.

Moderators: alexandrleonenko, Milton

nkd
Junior
Junior
Posts: 22
Joined: Apr 15th, '11, 22:37

php variables and apPHP tabs. URGENT HELP!!

Postby nkd » Oct 26th, '11, 11:53

I bought apPHP tabs to implement it on my project but I am having a hard time because I have this problem:

Variables declared on the parent page are not recognized in the child pages (pages called by tabs). But functions and values declared with @define () ARE recognized. In my parent page I have a file that I include using require_once. But the variables defined on that include are not recognized in the tab pages, but if I try to include that file again then it gives me an error because it says I can not redefine the functions that I have on that include and that were already defined in the include of the parent page!

I have a $user object which is an authenticated user. I can not leave my tabs pages without authentication so I have to check on the $user object which I can't access from the tabs pages. If I try to create another user object like if it was another webpage then It gives me errors because of functions already defined.

This is driving me crazy!

Please help me understand how the tabs include php code and how to deal with includes, variables, etc..

Thank you

nkd
Junior
Junior
Posts: 22
Joined: Apr 15th, '11, 22:37

Re: php variables and apPHP tabs. URGENT HELP!!

Postby nkd » Oct 26th, '11, 13:43

Here is the problem explained better (I think):

I have a config.inc.php file which has variables, functions, and the initialization of the $db object.

If I just include the config file in the parent page, then the variables and objects are not accessible to the tab pages, BUT the functions are.
If I include the config file in the tabs pages then I get an error because the functions are already declared.

It is like if the parent page and tabs pages are not completely dependent nor independent. They don't share objects and variables but they DO share constants (@define(CONSTANT)) and functions.

My temporary solution was to make a second include file config.inc2.php that is a copy of the original include but without the functions. That way it works.

I am still puzzled by this behavior.

administrator
Site Admin
Site Admin
Posts: 6005
Joined: Jan 7th, '09, 23:18
Contact:

Re: php variables and apPHP tabs. URGENT HELP!!

Postby administrator » Oct 27th, '11, 08:33

Do you mean that include in parent page is not recognized in child page?
1. Try to print on the screen all define variables:
http://php.net/manual/en/function.get-defined-vars.php

2. check if you don't kill them in parent page in some way before they coming visible in child page.


Return to “ApPHP Tabs”