Neo73 Posted March 28, 2014 Report Posted March 28, 2014 Hi, I tried to use the authentication class from the OOP login tutorial in combination with the OOP shopping cart. The problem is that both tutorials use different template methods, in particular getData(). Out of the box, the OOP login classes, just work fine, I can log in and out without problems. However, in combination with the m_template.php of the shopping cart, the login credentials (although correct) are posted at the top of the page and the 'access-denied' error message is displayed. I tracked the problem down to the getData()-function in m_template.php, which seems to cause the issue: getData() within login tutorial: function getData($name) { if (isset($this->data[$name])) { return $this->data[$name]; } else { return ''; } } getData() within shopping cart tutorial: public function getData($name, $echo = TRUE) { if (isset($this->data[$name])) { if ($echo) { echo $this->data[$name]; } else { return $this->data[$name]; } } return ''; } When I replace the getData()-function of the original login tutorial with the one in the shopping cart tutorial, I am able to log in and out, but no content is displayed any longer (i.e. no menus, no products). I would appreciate your help on how to integrate this properly. Quote
falkencreative Posted March 28, 2014 Report Posted March 28, 2014 Looks like the problem is that the defaults between those two functions are different. By default, the getData() function within the login tutorial returns the variable, whereas the default getData() function from the shopping cart tutorial echos the data. With that in mind, and considering that the login functionality involves less code, I would suggest using the getData() function from the cart tutorial, and make sure to pass "FALSE" in as the second parameter in any instances of getData() within the login code where you need to return the data rather than echo it out. My apologies about the default functionality changing -- I didn't even realize that till just now. I'm not completely sure why it changed, it's just what made sense to me at the time when I was developing it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.