MyBB Community Forums

Full Version: ECHO and EVAL
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear guys, please help.

How to convert such a string

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

into the one that you could use with ECHO tag in index.php file of the site's head page and so it would print Welcome Block for Memebers.

This one only prints regular welcome Block for guest (with login)
echo "$headerinclude 
    <div>
$welcomeblock </div>"

How make it also print Welcome Block for Members?Huh

Ilia
Hi,
Is there any particular reason why you must use echo?

As for your issue, it should display the welcomeblock for the logged in user, if such a user is logged in.
(2008-08-05, 09:29 AM)ZiNgA BuRgA Wrote: [ -> ]Hi,
Is there any particular reason why you must use echo?

As for your issue, it should display the welcomeblock for the logged in user, if such a user is logged in.

that is what I thought but it doesn't show infact? why? what do you think?

here is the code:

<?php
chdir('forums');
define("IN_MYBB", 1);
require './global.php';
?>


<?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 </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>';

} ?>
[/php]

Blush
if($mybb->user['uid'] != 1){
^ That's probably your issue. (but I'm not sure what exactly you want)


As an aside, if you just want to change the welcomeblock bar, I suggest editing the various header_welcomeblock_* templates. Your change to index.php won't appear globally (if that's what you're trying to get).
Well I'm not sure it will help.

All i want on the website's index page (which is not forum) display Welcome Block from the Forum.
If user logged in then it shows regular Welcome back, .... and all other info from the welcome block with out changing it. If user is not logged in then display Login prompt with register link, with date and time (again regular welcome guest block). After logging in redirect again to the site's home page (index page) but not the forums one.
That is all! Big Grin
How to achieve this?
Can anyone help me?