MyBB Community Forums

Full Version: Variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I installed the plugin to make custom pages but what do I need to put so that the page understands variables?
Which plugin did you install?
Page Manager (1.5.2)
Created by Sebastian Wunderlich
Just use PHP to echo out the variables. Be sure to globalize them first though. Here's a sample page: (don't enable "Use MyBB Template?")

<?php global $headerinclude, $header, $footer; ?>
<html>
<head>
<title>Example</title>
<?php echo $headerinclude; ?>
</head>
<body>
<?php echo $header; ?>
<p>Example</p>
<?php echo $footer; ?>
</body>
</html>
I think you meant to add $header, $footer etc. ? If so you can add this line;
global $headerinclude, $header, $theme, $footer;
and then add these variables in your page.
faviouz, always there when I need help!

Thanks a million, just what I needed!

And Yaldaram, same to you buddy! Big Grin
You're welcome.
It doesn't seem to be changing the variables to the correct value.

<?php global $headerinclude, $header, $footer; ?>
<html>
<head>
<?php echo $headerinclude; ?>
<title>Example</title>
<!-- PRO CHAT ROOMS  -->
<script language="JavaScript">
<!-- 
var userName = "{$mybb->user['username']}";
var userID = "{$mybb->user['uid']}";
var roomID = "Welcome!!!";
// -->
</script> 
<script language="JavaScript" type="text/javascript" src="/prochatrooms/chat.js"></script> 
</head>
<body>
<?php echo $header; ?>
<a href="javascript:launchChat();">Chatrooms</a>
<?php echo $footer; ?>
</body>
</html>
You can't do that, you have to echo it in PHP like I told you. Try this:

<?php global $headerinclude, $header, $footer, $mybb; ?>
<html>
<head>
<?php echo $headerinclude; ?>
<title>Example</title>
<!-- PRO CHAT ROOMS  -->
<script language="JavaScript">
<!-- 
var userName = "<?php echo $mybb->user['username']; ?>";
var userID = "<?php echo $mybb->user['uid']; ?>";
var roomID = "Welcome!!!";
// -->
</script> 
<script language="JavaScript" type="text/javascript" src="/prochatrooms/chat.js"></script> 
</head>
<body>
<?php echo $header; ?>
<a href="javascript:launchChat();"><img src="http://icons.iconarchive.com/icons/custom-icon-design/office/16/chat-icon.png" align="top">&nbsp;Chatrooms</a>
<?php echo $footer; ?>
</body>
</html>