MyBB Community Forums

Full Version: Welcome Block. Please help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

For creating welcome block on my website's index page i use this

echo "$headerinclude 
    <div>
$welcomeblock </div>

It works fine but I need additionally initiate template Member Template which in global.php is defined like this

eval("\$welcomeblock = \"".$templates->get("header_welcomeblock_member")."\";");



How to combine it so it works properly with ECHO tag?

The following doesn't work:

echo "$headerinclude 
    <div>
$welcomeblock = \"".$templates->get("header_welcomeblock_member")  </div>

It should be very easy. I just don't know PHP.

Thank you very much
If you add this at the top of your page;
$forumpath = './forum/';
chdir($forumpath);
define("IN_MYBB", 1);
require "./global.php";
You should be able to echo {$welcomeblock} ?
(2008-08-04, 01:39 PM)LeX- Wrote: [ -> ]If you add this at the top of your page;
require "./global.php";
You should be able to echo {$welcomeblock} ?

Yes I'm able to. but i want to create it depending on the user Login status.

logged in then it prints Member Template, logged out then regular guest template with login field.

I initiated at the very top of the website's index.php file this
<?php
chdir('forums');
define("IN_MYBB", 1);
require './global.php';
?>

in the body trying to do use like this:
<?PHP 
if($mybb->user['uid'] != 1){
echo '<a href=/forums/><img src="images/0_title_forum.gif" style="margin-left:-5px; margin-top:4px; margin-bottom:8px"></a><br />';
echo "$headerinclude 
    <div>
$welcomeblock = \"".$templates->get("header_welcomeblock_member")</div>";
}
else
{
echo '<div style="margin:0px 0px -18 0px"><a href=/forums/><img src="images/0_title_forum.gif" style="margin-left:-5px; margin-top:4px; margin-bottom:8px"></a><br />';
echo "<strong>Welcome, Guest! </strong><br /><br />"; echo "("; echo '<a href=/forums/member.php?action=login id="login" rel="subcontent">Login</a> '; echo "— <strong><a href=/forums/member.php?action=register>Register</a></strong> — <a href=/forums/misc.php?action=help>Help</a>)</div>"; 
echo '<script type="text/javascript">dropdowncontent.init("login", "right-bottom", 600) </script>';

} ?>

So it show only Regular Login Box nevertheless LOGIN STATUS. Undecided I'm logged in but it show Guest Welcome Block with login, password, Lost your password, Register.

I used for this
echo "$headerinclude 
    <div>
$welcomeblock </div>";
}

Now I need to add to the $welcomeblock this

= \"".$templates->get("header_welcomeblock_member")

But do this right so it works via ECHO tag and prints welcomeblock_member

Did I explained it well?Smile How to do this?