sorry guys if I am in the wrong forum but consider it a support + chit chat ;D
I want to put this code
if($user_info['is_guest'])
{
//Show popup code here
}
in my index.template.php
but do not know where to put it
any body can give me an Idea :uglystupid2:
Can I ask what you are trying to accomplish? And why do you want to put it into the index.template.php file? Since you do not really show the popup code, and there does not appear to be any termination of following code (at least not self evident), why not put into one of your "guest visible" php blocks?
Thank for the reply. I wanted to put it in a block just for guests to see
but I faced one problem I as admin can see this floating banner too
I made a block and set the permission so that only guests of my board get a big floating banner asking them to register . every thing is fine but I as admin get this annoying floating thing too
any Idea?
Sure.. its very simple... make sure your block is set to not show a frame or title, and make it non-shrinkable.
Put this code in the block:
// needed globals
global $context;
if ($context['user']['is_guest']){
// all your code in here
}
I as admin can still see it.
I chose the permission for guests only but still it pops for admin
As admin you will always see every thing, you cant turn the blocks off for admins, you can only shrink them down, but they will always be visible to you as Admin
thank you for your support.
sorry what do you mean?
this is my setting:
Do not use title/frame ( is checked)
Do not allow block to collapse ( is checked)
now my problem is that I have made a big floating banner which is shown to guests but it gets into my way too even when I am loged in.
Just what i said, As administrator, you will always see every thing, you cant turn off blocks, articles like you can to other membergroups. They will always show for you no matter the settings you have or do
ok thanks. it is understandable .
any mayhow do you show a pop up or a floating banner to guests?
what would you do if you were me? :(
make a block for guest (phpbox)
put this code in:
if (in_array('1',$GLOBALS['user_info']['groups']))
{
echo '';
}
else
{
echo 'banner code';
}
put your banner code in ^^
and make box no title no frame, and you will not see it
it works
The code I gave you works. Recheck that you put the code in the correct place. Also make sure you add the global line. As an Admin $context['user']['is_guest'] will be false and therefore not run the code within the if() block.
ok guys this is the banner I want to add
<div id="theLayer" style="z-index: 999; left: 5px; visibility: visible; width: 650px; position: absolute; top: 530px"><table style="height: 322px" cellspacing="0" cellpadding="5" width="650" bgcolor="#ffcc00" border="0"><tbody><tr><td style="width: 100%; height: 312px"><table style="height: 36px" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td id="titleBar" style="width: 100%; cursor: move"><a href="http://www.mydomain.com"><img id="domain" height="18" src="images/pop.gif" width="162" border="0" /></a> </td><td style="cursor: hand" valign="top"><a style="text-decoration: none" onclick="hideMe();return false"><font style="font-weight: bold; text-decoration: none" face="Arial" color="#ffffff" size="2">X</font></a> </td></tr><tr><td lang="fa" dir="rtl" style="padding-right: 4px; padding-left: 4px; padding-bottom: 4px; width: 100%; padding-top: 4px" align="center" bgcolor="#ffffff" colspan="2"><table lang="fa" dir="ltr" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td><a href="../undefined/english"><img id="notic" height="124" src="/images/logopop.gif" width="120" align="right" border="0" /></a></td><td lang="fa" dir="rtl" style="font-size: 35px; font-family: 'Times New Roman'; text-align: center"><div style="font-size: 35px; font-family: 'Times New Roman'; text-align: center"><strong><font color="#ff0000">Please log in</font></strong> </div><div style="font-weight: bold; font-size: 45px; font-family: 'Times New Roman'; text-align: center"><font size="4">Some of our topics might not be viewable by guests. To be able<br />to view all recent topics you need to login with your ID and Password </font><font size="6"><br /></font><font size="3"> </font></div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div>
so where should I put this if thing? :uglystupid2:
// needed globals
global $context;
if ($context['user']['is_guest']){
// all your code in here
}
Here's how you would do it in a phpbox block.
// needed globals
global $context;
if ($context['user']['is_guest']){
echo '
<div id="theLayer" style="z-index: 999; left: 5px; visibility: visible; width: 650px; position: absolute; top: 530px"><table style="height: 322px" cellspacing="0" cellpadding="5" width="650" bgcolor="#ffcc00" border="0"><tbody><tr><td style="width: 100%; height: 312px"><table style="height: 36px" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td id="titleBar" style="width: 100%; cursor: move"><a href="http://www.mydomain.com"><img id="domain" height="18" src="images/pop.gif" width="162" border="0" /></a> </td><td style="cursor: hand" valign="top"><a style="text-decoration: none" onclick="hideMe();return false"><font style="font-weight: bold; text-decoration: none" face="Arial" color="#ffffff" size="2">X</font></a> </td></tr><tr><td lang="fa" dir="rtl" style="padding-right: 4px; padding-left: 4px; padding-bottom: 4px; width: 100%; padding-top: 4px" align="center" bgcolor="#ffffff" colspan="2"><table lang="fa" dir="ltr" style="border-collapse: collapse" bordercolor="#111111" cellspacing="0" cellpadding="0" width="100%" border="0"><tbody><tr><td><a href="../undefined/english"><img id="notic" height="124" src="/images/logopop.gif" width="120" align="right" border="0" /></a></td><td lang="fa" dir="rtl" style="font-size: 35px; font-family: 'Times New Roman'; text-align: center"><div style="font-size: 35px; font-family: 'Times New Roman'; text-align: center"><strong><font color="#ff0000">Please log in</font></strong> </div><div style="font-weight: bold; font-size: 45px; font-family: 'Times New Roman'; text-align: center"><font size="4">Some of our topics might not be viewable by guests. To be able<br />to view all recent topics you need to login with your ID and Password </font><font size="6"><br /></font><font size="3"> </font></div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></div>';
}
thanks I appreciate for your time to help me but I get this
Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/hosting_users/www/english/Sources/Load.php(1733) : eval()'d code(35) : eval()'d code on
It were 2-3 font names that was wrongly enclosed in single quotes...also I indented the code. Its MUCH easier to spot errors once that is done. ;)
// needed globals
global $context;
if ($context['user']['is_guest']){
echo '
<div id="theLayer" style="z-index: 999; left: 5px; visibility: visible; width: 650px; position: absolute; top: 530px">
<table style="height: 322px" cellspacing="0" cellpadding="5" width="650" bgcolor="#ffcc00" border="0">
<tbody>
<tr>
<td style="width: 100%; height: 312px">
<table style="height: 36px" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td id="titleBar" style="width: 100%; cursor: move">
<a href="http://www.mydomain.com"><img id="domain" height="18" src="images/pop.gif" width="162" border="0" /></a>
</td>
<td style="cursor: hand" valign="top">
<a style="text-decoration: none" onclick="hideMe();return false"><font style="font-weight: bold; text-decoration: none" face="Arial" color="#ffffff" size="2">X</font></a>
</td>
</tr>
<tr>
<td lang="fa" dir="rtl" style="padding-right: 4px; padding-left: 4px; padding-bottom: 4px; width: 100%; padding-top: 4px" align="center" bgcolor="#ffffff" colspan="2">
<table lang="fa" dir="ltr" style="border-collapse: collapse;" bordercolor="#111111" cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td>
<a href="../undefined/english"><img id="notic" height="124" src="/images/logopop.gif" width="120" align="right" border="0" /></a>
</td>
<td lang="fa" dir="rtl" style="font-size: 35px; font-family: Times New Roman; text-align: center">
<div style="font-size: 35px; font-family: Times New Roman; text-align: center">
<strong><font color="#ff0000">Please log in</font></strong>
</div>
<div style="font-weight: bold; font-size: 45px; font-family: Times New Roman; text-align: center">
<font size="4">Some of our topics might not be viewable by guests. To be able<br />to view all recent topics you need to login with your ID and Password </font><font size="6"><br /></font><font size="3"> </font>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>';
}
thanks guys! spent your time to help me! if there is any thing I can do for you please let me.
I will be more than glad to help you in any way. :)
God bless this forum
you know I am doing some missionary work in here so need a lot help
Glad it worked.
I can't help much with your mission, but for anything code related you are on the right place. ;)
hehe.. well, since the requestor actually showed php code in his first post, I assumed he knew php syntax but just didn't know what to use for excluding an Admin. I probably should have asked him to show his "pop-up" code originally. If I did, I probably would have realized he wasn't using an echo statement to write his code to the php processor. hehe.. Sorry korea, bad assumption on my part. Glad you are working now. :)