Current time: 01-09-2009, 10:15 AM Hello There, Guest! (LoginRegister)


Post Reply 
ECHO and EVAL
08-05-2008, 08:01 AM
Post: #1
Thumbs Up ECHO and EVAL
Dear guys, please help.

How to convert such a string

PHP Code:
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)
PHP Code:
echo "$headerinclude 
    <div>
$welcomeblock </div>" 

How make it also print Welcome Block for Members?Huh

Ilia
Find all posts by this user
Quote this message in a reply
08-05-2008, 09:29 AM
Post: #2
RE: ECHO and EVAL
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.

Who is Yumi?


It's still the KFC crazed person who can't spell names properly with annoying AlTeRnAtInG CaPiTaLs in the NaMe
Visit this user's website Find all posts by this user
Quote this message in a reply
08-05-2008, 09:46 AM (This post was last modified: 08-05-2008 09:48 AM by eligrowleo.)
Post: #3
RE: ECHO and EVAL
(08-05-2008 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 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
Find all posts by this user
Quote this message in a reply
08-05-2008, 09:54 AM (This post was last modified: 08-05-2008 09:55 AM by Yumi.)
Post: #4
RE: ECHO and EVAL
PHP Code:
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).

Who is Yumi?


It's still the KFC crazed person who can't spell names properly with annoying AlTeRnAtInG CaPiTaLs in the NaMe
Visit this user's website Find all posts by this user
Quote this message in a reply
08-05-2008, 10:03 AM (This post was last modified: 08-05-2008 05:41 PM by eligrowleo.)
Post: #5
RE: ECHO and EVAL
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?
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: