Can I get the shoutbox to appear on other areas of my site?
I want to get it on my forum page without being in a side block.
You should be able to just call the function if TP is loaded on the page you're putting it in.
echo TPortal_shoutbox();
Hi, umm, I'm not quit sure how to do this, well my code looks like this:
echo'<table><tr><td>TPortal_shoutbox()</td></tr></table>';
That would probably be incorrect?
You forgot to put in the ; after TPortal_shoutbox();
Thanks, but I think I best paste the whole code here.
This is in the SMF Info Center...
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="0" width="50%" border="0">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="middletext" align="center" valign="top"><b>', $post['link'], '</b> <br>', $txt[525], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</td>
</tr>
';
echo '
</table>';
}
echo '
</td>
</tr>';
}
Now what I want it to be is kind of like this....
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="0" width="50%" border="0">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="middletext" align="center" valign="top"><b>', $post['link'], '</b> <br>', $txt[525], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</td>
</tr>
';
</table><table><tr>echo TPortal_shoutbox();<td></td></tr></table>';
}
echo '
</td>
</tr>';
}
That obviously doesn't work, could someone help and put the shoutbox in for me at the correct location? Thanks!
What kind of result does that give you. DOes it do anything at all?
Add a center block and choose the shoutbox, why complicate things when they are built in to just fetch with a few clicks ?
That gives an error, the correct form of that would be :
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table cellpadding="0" cellspacing="0" width="50%" border="0">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="middletext" align="center" valign="top"><b>', $post['link'], '</b> <br>', $txt[525], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</td>
</tr>
';
echo '
</table><table><tr>echo TPortal_shoutbox();<td></td></tr></table>';
}
echo '
</td>
</tr>';
}
And that just displays the text echo TPortal_shoutbox();
Putting it in a center block would put it below the fold....
I am playing with it. I am not a coder by any means but I am trying to get it to work.
Thank you very much!
You just need to learn the proper code for the echo statement. Feel free to read my little tutorial. :)
http://www.ichbin.us/index.php?topic=19.0
Very helpful, I got it to work. Thank you.
Ahh a follow up question, where do I set how many lines the shoutbox shows or what size it is?
You can view the settings in the admin panel for the shoutbox in the TP section. If you want to change any other settings than that you'll have to modify the actual function code in the TPortalBlocks.template.php file.
Thank you a lot. More questions from the coding noob. I've been thumbing through the TPtemplate files for a while but still don't understand them as well as I like. Expect more questions! :)
I edited the changes in the admin, but it still doesn't look 100% like I want. My biggest grip right now is how much horizontal space is being wasted. How do I get the timestamp to appear right next to the name.
For example it would be something like General_Sun - Today at 11:30:37 PM
I took a look in TPortalBlocks but it doesn't seem to be there...
This looks more promising:
case 'shoutbox':
// show the linktree
theme_linktree();
// Show the shoutbox, takes settings from tpadmin
if(isset($context['TPortal']['querystring']))
$tp_where=$context['TPortal']['querystring'];
else
$tp_where='';
if(!isset($context['TPortal']['shoutbox']))
$context['TPortal']['shoutbox']='';
echo '
<div class="tborder">
<table style="margin-bottom: 2px; table-layout: fixed;" class="windowbg" cellpadding="20" cellspacing="0" border="0" width="100%">
<tr>
<td>', $context['TPortal']['shoutbox'], '</td>
</tr>
</table>
<div class="windowbg2" style="padding-top: 10px;">
<form accept-charset="', $context['character_set'], '" style="margin-top: 8px; text-align: center;" name="tp-shoutbox" action="'.$scripturl.'?action=tpmod&id=shout" method="post">';
if(($context['TPortal']['guest_shout']) || (!$context['TPortal']['guest_shout'] && !$context['user']['is_guest']))
echo '
<textarea name="tp-shout" style="width: 50%; height: 50px;" type="text"></textarea><br /><input style="margin-top: 4px;" class="smalltext" type="submit" name="shout_send" value="'.$txt['shout!'].'">';
if($context['user']['is_guest'] && $context['TPortal']['guest_shout'])
echo '
<br /><input style="margin-top: 4px;" size="20" type="text" name="tp-shout-name" value="'.$txt['tp-guest'].'">';
else
echo '<input type="hidden" name="tp-shout-name" value="'.$context['user']['name'].'">';
echo '<input name="tp-shout-url" type="hidden" value="'.$tp_where.'">
<input name="sc" type="hidden" value="'.$context['session_id'].'">
</form>
</div>
</div>';
Doing my noobie scanning of the code, it seems as if what I want is near the bottom. I see where it echos the value="'.$context['user']['name'].'" but what about the time?
Just now getting back in and saw this. Care to post the way you got it to work.
Certainly, I added a bit of css to get my recent post and shoutbox to display side by side.
/* Sun's custom classes */
#lastest_post_table
{
float:left;
}
#shoutbox_table
{
float:right;
}
The echo maze is here:
// Show lots of posts.
elseif (!empty($context['latest_posts']))
{
echo '
<table id="lastest_post_table" cellpadding="0" cellspacing="0" width="40%" border="0">';
/* Each post in latest_posts has:
board (with an id, name, and link.), topic (the topic's id.), poster (with id, name, and link.),
subject, short_subject (shortened with...), time, link, and href. */
foreach ($context['latest_posts'] as $post)
echo '
<tr>
<td class="middletext" align="center" valign="top"><b>', $post['link'], '</b> <br>', $txt[525], ' ', $post['poster']['link'], ' (', $post['board']['link'], ')</td>
</tr>
';
echo '
</table><table id="shoutbox_table" width="50%" valign="top"><tr><td>';
echo TPortal_shoutbox();
echo '</td></tr></table>';
}
echo '
</td>
</tr>';
}
Actually the code you posted General is the code for the layout of the block. The actual content is formated in TPortal.php.
while($row = mysql_fetch_assoc($request))
{
$shouts .='<div style="margin: 4px;"><div style="border: dotted 1px; padding: 2px 4px 2px 4px;" class="windowbg2"><b>'.$row['value3'].'</b></div><div style="padding: 2px;"> '.timeformat($row['value2']).'</div><div style="padding: 4px;">';
$myshout='';
$myshout=$row['value1'];
$shouts .= doUBBC($myshout);
$shouts .= '</div></div>';
}
Notice the "timeformat" ? :)
Thank you so much! :D
Works great thanks!