jQuery - ajax page load - php scope
- by Develman
I am using jquery.tabs() and want to load the pages of the tabs with ajax. I am using MVC pattern with PHP and used a frontcontroller / pagecontroller pattern. The templating is done by PHP, e.g.:
<?php if($this->userLoggedIn == TRUE): ?>
<span>Herzlich Willkommen <?php echo $this->userName; ?>!
[<a href="logout">Ausloggen</a>]
</span>
<?php endif; ?>
The variables ($this-userName) are injected by the pagecontroller class.
The problem is, that when I load a page via ajax, the variables are not known. Following PHP error is coming up:
Fatal error: Using $this when not in object context....
Any idea, how to use / load the variables and using it in the template files.