TinyPortal

Development => Support => Topic started by: sburke930 on May 24, 2009, 10:12:25 PM

Title: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on May 24, 2009, 10:12:25 PM
I have looked at IchBins post regarding the change in a previous version of TP but that no longer works.  Is there a way to move text entry to the top in 1.0 Beta 4?  I have not been able to find anything on this subject.

My members are used to having the text box on the top and have complained about it since we converted to SMF.

Thank you in advance!

EDIT~ Changed the topic line since I recently installed beta 4.
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 3
Post by: IchBin on May 25, 2009, 12:40:29 AM
Open the TPShout.template.php file and edit the function template_tpshout_shoutblock()

You will see all of the input boxes for this if you need to change them.
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 3
Post by: sburke930 on May 25, 2009, 05:31:54 AM
/me scratches her head

I see all the code but I do not know what I am supposed to edit. ???
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 3
Post by: sburke930 on May 26, 2009, 03:58:23 PM
After asking the members exactly what they were looking for they have stated they want the time stamp removed, the entry box at the top, and the background color changed.  I can change the background in the style sheet but I have no idea how to remove the time stamp or move the text entry to the top.

Please help!
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 3
Post by: sburke930 on May 29, 2009, 03:05:00 AM
I still cannot figure it out.  If someone could help me I would really appreciate it!

Thank you!
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 01, 2009, 01:21:29 AM
I know I should not be posting over and over again but is there anyone that can help me to change the shoutbox text entry location?  I am not an expert and have no clue what changes I need to make.

Thank you!
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: ZarPrime on June 01, 2009, 02:13:00 AM
sburke930,

I'll see if I can figure it out, but it will be tomorrow now before I can even look at it.  In the meantime, please post back here exactly what order you want the various stuff in the shoutbox  to be in.  I can't guarantee that what I do will work as I'm not the best at php, but I'll see if I can figure it out if you give me the exact order you want stuff to be in.

ZarPrime
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 01, 2009, 02:37:24 AM
Thank you!

The order should be:


If you can, please do NOT include the time stamp.  We just want the members name (centered if possible) above the shouts.

Whatever you can do is appreciated very much!
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: ZarPrime on June 03, 2009, 12:37:53 AM
Hi sburke930,

Sorry it took so long.  I've had a lot to do this week.

First of all, as far as removing the time stamp and centering the member's name, maybe someone else can help you with that.  I'm not a coder.

To move the entry box up to below the the smileys, open up the /public_html/YourSite/Themes/default/TPShout.template.php file and ...

Find This ...

function template_tpshout_shoutblock()
{

global $context, $settings, $options, $scripturl, $txt, $modSettings, $sourcedir;

// Show the shoutbox, takes settings from tpadmin
$tp_where=$_SERVER['QUERY_STRING'];

if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';

$context['shoutbox_form'] = 'tp_shoutbox';
$context['shout_post_box_name'] = 'tp_shout';

echo  '
<div class="tp_shoutboxblock">';

if(!empty($context['TPortal']['show_shoutbox_smile']))
shout_smiley_code();
if(!empty($context['TPortal']['show_shoutbox_icons']))
shout_bcc_code();
if(!empty($context['TPortal']['show_shoutbox_smile']))
print_shout_smileys();

echo '
</div>';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="shoutcontainer">
'.$context['TPortal']['shoutbox'].'
</div>';
elseif($context['TPortal']['shoutbox_usescroll']=='2')
echo '<br />
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table cellpadding="0" align="center" width="100%" cellspacing="0" style="table-layout: fixed;">
<tr>
<td><div class="smalltext" style="width: 99%; height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto;">', $context['TPortal']['shoutbox'], '</div></td>
</tr>
</table>';

echo '
<form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';

if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
{
echo '
<textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
}
if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
echo '<br />
<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
else if(allowedTo('tp_can_shout'))
echo '
<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';

echo '
<a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
<input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';

}


and Replace with this ...


function template_tpshout_shoutblock()
{

global $context, $settings, $options, $scripturl, $txt, $modSettings, $sourcedir;

// Show the shoutbox, takes settings from tpadmin
$tp_where=$_SERVER['QUERY_STRING'];

if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';

$context['shoutbox_form'] = 'tp_shoutbox';
$context['shout_post_box_name'] = 'tp_shout';

echo  '
<div class="tp_shoutboxblock">';

if(!empty($context['TPortal']['show_shoutbox_smile']))
shout_smiley_code();
if(!empty($context['TPortal']['show_shoutbox_icons']))
shout_bcc_code();
if(!empty($context['TPortal']['show_shoutbox_smile']))
print_shout_smileys();

//Move Form to Start Here
echo '
<form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';

if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
{
echo '
<textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
}
if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
echo '<br />
<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
else if(allowedTo('tp_can_shout'))
echo '
<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';

echo '
<a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
<input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
//Move Form to End Here

echo '
</div>';
if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="shoutcontainer">
'.$context['TPortal']['shoutbox'].'
</div>';
elseif($context['TPortal']['shoutbox_usescroll']=='2')
echo '<br />
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table cellpadding="0" align="center" width="100%" cellspacing="0" style="table-layout: fixed;">
<tr>
<td><div class="smalltext" style="width: 99%; height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto;">', $context['TPortal']['shoutbox'], '</div></td>
</tr>
</table>';

//Move Form From Start Here
// echo '
// <form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';
//
// if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
// {
// echo '
// <textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
// <input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
// }
// if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
// echo '<br />
// <input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
// else if(allowedTo('tp_can_shout'))
// echo '
// <input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';
//
// echo '
// <a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
// <input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
// <input type="hidden" name="sc" value="', $context['session_id'], '" />
// </form>';
//Move Form From End Here

}


That's it.  Your shoutbox should now look like the image below.  I recommend you make a backup of the original file before doing the edits.

ZarPrime
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 03, 2009, 01:52:55 AM
Well that did not work.

Here is the error I got

There was a problem loading the /Themes/default/TPShout.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\)

Thank you very much for trying.

EDIT~ I had to remove a bunch of code that was left over in your post.  I am assuming it wasnt meant to be there anyway.

It is the way we want it now.  At least the text area.

If someone can help me remove the time stamp and date that would be awesome!
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: ZarPrime on June 03, 2009, 02:27:05 AM
You may be right.  I did make one mistake, even though it worked fine on my test site.  Try the following as the replacement code instead of what I posted in the message above.  Find the same area and replace it with this ...

function template_tpshout_shoutblock()
{

global $context, $settings, $options, $scripturl, $txt, $modSettings, $sourcedir;

// Show the shoutbox, takes settings from tpadmin
$tp_where=$_SERVER['QUERY_STRING'];

if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';

$context['shoutbox_form'] = 'tp_shoutbox';
$context['shout_post_box_name'] = 'tp_shout';

echo  '
<div class="tp_shoutboxblock">';

if(!empty($context['TPortal']['show_shoutbox_smile']))
shout_smiley_code();
if(!empty($context['TPortal']['show_shoutbox_icons']))
shout_bcc_code();
if(!empty($context['TPortal']['show_shoutbox_smile']))
print_shout_smileys();

echo '
</div>';

//Move Form to Start Here
echo '
<form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';

if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
{
echo '
<textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
<input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
}
if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
echo '<br />
<input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
else if(allowedTo('tp_can_shout'))
echo '
<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';

echo '
<a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
<input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
<input type="hidden" name="sc" value="', $context['session_id'], '" />
</form>';
//Move Form to End Here

if($context['TPortal']['shoutbox_usescroll']=='1')
echo '
<div id="shoutcontainer">
'.$context['TPortal']['shoutbox'].'
</div>';
elseif($context['TPortal']['shoutbox_usescroll']=='2')
echo '<br />
<div id="marqueecontainer" onmouseover="copyspeed=pausespeed" onmouseout="copyspeed=marqueespeed">
<div id="vmarquee" class="smalltext" style="text-align: left;position: absolute; width: 98%;">
'.$context['TPortal']['shoutbox'].'
</div>
</div>';
else
echo '
<table cellpadding="0" align="center" width="100%" cellspacing="0" style="table-layout: fixed;">
<tr>
<td><div class="smalltext" style="width: 99%; height: '.$context['TPortal']['shoutbox_height'].'px; overflow: auto;">', $context['TPortal']['shoutbox'], '</div></td>
</tr>
</table>';

//Move Form From Start Here
// echo '
// <form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';
//
// if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
// {
// echo '
// <textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
// <input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
// }
// if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
// echo '<br />
// <input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
// else if(allowedTo('tp_can_shout'))
// echo '
// <input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';
//
// echo '
// <a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
// <input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
// <input type="hidden" name="sc" value="', $context['session_id'], '" />
// </form>';
//Move Form From End Here

}


I just tested this on my test site and it works fine.

ZarPrime
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 03, 2009, 02:46:01 AM
When I removed the following from the code you posted before it worked fine
//Move Form From Start Here
// echo '
// <form  accept-charset="', $context['character_set'], '" class="smalltext" style="padding: 0; margin: 8px 0 8px 0; text-align: center;" name="'. $context['shoutbox_form']. '"  id="'. $context['shoutbox_form']. '" action="'.$scripturl.'?action=tpmod;shout=save" method="post" >';
//
// if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
// {
// echo '
// <textarea class="editor" name="'. $context['shout_post_box_name']. '" id="'. $context['shout_post_box_name']. '" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);" onchange="storeCaret(this);" style="width: 80%;margin-top: 1ex; height: 50px;"  tabindex="', $context['tabindex']++, '"></textarea><br />
// <input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'" />';
// }
// if($context['user']['is_guest'] && allowedTo('tp_can_shout'))
// echo '<br />
// <input style="margin-top: 4px;" size="20" class="smalltext" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'" />';
// else if(allowedTo('tp_can_shout'))
// echo '
// <input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'" />';
//
// echo '
// <a href="' , $scripturl , '?action=tpmod;shout=show50">' . $txt['tp-showlatest'] . '</a>
// <input name="tp-shout-url" type="hidden" value="'. htmlspecialchars($tp_where).'" />
// <input type="hidden" name="sc" value="', $context['session_id'], '" />
// </form>';
//Move Form From End Here
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: IchBin on June 03, 2009, 04:42:08 AM
In the TPShout.php file you'll find this section that creates the shouts.
while($row = tpdb_fetch_assoc($request))
{
$ns[] = '<div class="singleshout">
<div style="margin: 4px;"><div class="shoutheader windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '. timeformat($row['value2']).'</div><div style="padding: 4px;">
' . doUBBC(censorText($row['value1'])) . '</div></div></div>';
}


If you want the time and date removed you can probably remove just this part:
'. timeformat($row['value2']).'
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 03, 2009, 06:50:56 AM
Thank you, I will try that!

EDIT!  The template file right?  I can't find it in the template; control F and nothing.  :(
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: G6Cad on June 03, 2009, 07:09:06 AM
Not the template file but in the /sources/ directory TPShout.php
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: IchBin on June 03, 2009, 07:32:44 PM
Quote from: sburke930 on June 03, 2009, 06:50:56 AM
Thank you, I will try that!

EDIT!  The template file right?  I can't find it in the template; control F and nothing.  :(

No, I would have typed TPShout.template.php if it was the template file. :D
Title: Re: Change the position of shoutbox text entry in TP1.0 Beta 4
Post by: sburke930 on June 04, 2009, 01:22:55 AM
Ahhh shucks, I found it!  It was well down into the modules where I hadn't expected it to be.  It's all set now.  Thank you for your help IchBin and ZarPrime.

SOLVED!