I just got very frustrated with PHP. I am trying to figure out how all these pieces fit together, but all the articles I find are from 2012 or earlier, which is useless. Solved. See comments.
Here's basically what i'm trying to do:
loginpage.php:require autoload.php;
require facebook.php;
use Facebook/Session;
facebook.phpuse Facebook/Session;
use Facebook/LoginRedirectHelper;
// do stuff
$facebookloginurl = $helper->getlogin();
loginpage.php (continued):<a href="$facebookloginurl;">login</a>
^ This is an error. Even though I am using the same namespace, the variables do not exist that I set in the included file!
I am wondering what the proper method of handling this would be, such as having to define my own namespace and class to make it available to the main page…? I know theres a few PHP guru's here. I know it….
The only thing I can see (and it may just be because you were paraphrasing the file) is the line:
Sorry I should have put <?php around it to make it clear it was within tags. But in either case I get this error:
Undefined variable: facebookloginurl in /[…]/swap/app/testsocial.php on line 46Edit: figured out the error:The namespaces didn't matter, but it was because I put the variables in a function that made them inaccessible. I tried using globals at one point but it didn't work for whatever reason, which got me confused.Ah, yes, that makes sense. Glad you figured it out! :)