Hi,
I am currently working on an internal site for the company I work with, and have found CouchCMS to be excellent to work with for this particular purpose.
My problem has to do with a page, which is embedded whenever the masterpage is accessed without specifying the page id (same as outlined in the Tutorials section).
Each page in my site checks for the 'username' variable to be present, in order to evaluate whether the current user is actually logged in. Apart from this, I also use that variable in a "Welcome" message.
In my embedded page I have places this at the top (before the !DOCTYPE html tag):
This works perfectly since the username gets printed on screen (from the very last line, which I added as a test).
Now within the actual page I try to display the username like this:
but it seems that the parameter is non-existent at that point. Please help!
I am currently working on an internal site for the company I work with, and have found CouchCMS to be excellent to work with for this particular purpose.
My problem has to do with a page, which is embedded whenever the masterpage is accessed without specifying the page id (same as outlined in the Tutorials section).
Each page in my site checks for the 'username' variable to be present, in order to evaluate whether the current user is actually logged in. Apart from this, I also use that variable in a "Welcome" message.
In my embedded page I have places this at the top (before the !DOCTYPE html tag):
- Code: Select all
<cms:php>
session_start();
global $user;
if(!isset($_SESSION['username'])){
header("location:index.php");
}else{
$user = $_SESSION['username'];
echo "User: $user";
}
</cms:php>
This works perfectly since the username gets printed on screen (from the very last line, which I added as a test).
Now within the actual page I try to display the username like this:
- Code: Select all
<p>Welcome <cms:php>print(\"<b>$user</b>\");</cms:php> <a href="logout.php">logout</a></p>
but it seems that the parameter is non-existent at that point. Please help!