rejetto forum

Help needed: Shoutbox

0 Members and 1 Guest are viewing this topic.

Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Hi, i seem to need some help with a small script for the ToG Shoutbox since all i know from scripting is only enough to pass by. What i wanted to do was to only show the message and submit button to users logged in, while hidding it from who isn't.

This is the original code:
---------------------------------------------------------------------------------------------------------------------------------------------


<head>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
   <link rel="stylesheet" type="text/css" href="/template/code/tog_main.css"/>
</head>
<body onload="window.scrollTo(0,99999)" id="msgBody">
{.$files.}
<form name="shout" action="/template/shoutbox/process_posts/" method="post" id="msgForm">
<center>
   <input type="text" name="user" size="17" maxlength="30" value="{.if|%user%|%user%|{.!lv_guest.}.}" class="formInput"  onclick="if(this.value=='{.!lv_guest.}')this.value=''"/><br/>
   <input type="text" name="msg" size="17" maxlength="150" value="{.!lv_msg.}" class="formInput" id="msgInput" title="{.!lv_smileys.}: :) :D ;D ;) :S :$ :P :o :'( :( (h)" onclick="if(this.value=='{.!lv_msg.}')this.value=''"/><br/>
   <input type="submit" value="{.!lv_shout.}" id="msgSubmit"/>
</center>
</form>
</body>
</html>

---------------------------------------------------------------------------------------------------------------------------------------------

Been trying for a few hours but can't seem to actually understand the code enough to do so.


Offline Giant Eagle

  • Moderator
  • Tireless poster
  • *****
    • Posts: 535
  • >=3 RAWR!
    • View Profile
    • RAWR-Designs.com
Tho i have not tested this code, it 'should' work.

Code: [Select]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="/template/code/tog_main.css"/>
</head>
<body onload="window.scrollTo(0,99999)" id="msgBody">
{.if|%user%|
{.$files.}
<form name="shout" action="/template/shoutbox/process_posts/" method="post" id="msgForm">
<center>
<input type="text" name="user" size="17" maxlength="30" value="{.if|%user%|%user%|{.!lv_guest.}.}" class="formInput"  onclick="if(this.value=='{.!lv_guest.}')this.value=''"/><br/>
<input type="text" name="msg" size="17" maxlength="150" value="{.!lv_msg.}" class="formInput" id="msgInput" title="{.!lv_smileys.}: :) :D ;D ;) :S :$ :P :o :'( :( (h)" onclick="if(this.value=='{.!lv_msg.}')this.value=''"/><br/>
<input type="submit" value="{.!lv_shout.}" id="msgSubmit"/>
</center>
</form>
|Unauthorized.}
</body>
</html>


Offline Kremlin

  • Tireless poster
  • ****
    • Posts: 137
    • View Profile
Got it to work tks :D

ps. actually if you place the 'if user' tag below the 'form name' non-logged people can still read but not post which turns out to be a good way to control the quality and amount of posts
« Last Edit: January 19, 2009, 11:12:39 PM by Kremlin »