MyBB Community Forums

Full Version: question?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
i want to display the HTML tag in mybb if user logged in?
for example i want to display an ADS in my forum if user logged in? if not logged in the ADS won't show.
please tell me how i do it?
in the global.php

find

 unset($admincplink);
below it add
 if($mybb->user['uid'] == 0)
{
	$banner = "";
} else {
	$banner = "CODE HERE";
}
*you code must be escaped
now use $banner in any template.

However you can also use Easy Adv. Banner 2.0 and use its variable in the codes mentioned above.

regards
$banner = "CODE HERE";

Instead of that, you may want to use this instead:

$banner = <<<BANNER
[b]CODE HERE[/b]
BANNER;

Using that format and leaving <<<BANNER and BANNER; in place will allow you to use both double and single quotes in the code without having to escape them.

With the first way, you'd have to write something like

<a href=\"http://www.mybboard.com\">MyBB</a>

But with the second way, you can write it normally without the slashes. Smile
Quote:Code:
$banner = "CODE HERE";



Instead of that, you may want to use this instead:


Code:
$banner = <<<BANNER
CODE HERE
BANNER;



Using that format and leaving <<<BANNER and BANNER; in place will allow you to use both double and single quotes in the code without having to escape them.
It wont work
It will.
but using $banner = 'CODE HERE'; would probably be best so you won't have to parse the ""
Or you could just show us your code and we can "fix" it for you.
Zaher, why do you say that heredoc syntax won't work there? Granted, if you're using anything below PHP4, then you're right, it won't work.

I always advise people who are not proficient in PHP to use that syntax so they don't get hit with parse errors. It's also much easier than having to escape everything in your code.
It mostely wont work with evals
thanks Zaher
now....
can i use that codes in templates?
Add $banner where ever you want it to show. in the templates that is.
Pages: 1 2