TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

April 16, 2024, 08:36:07 PM

Login with username, password and session length
Members
  • Total Members: 3,885
  • Latest: Growner
Stats
  • Total Posts: 195,161
  • Total Topics: 21,219
  • Online today: 106
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online

How to increase "Show forum-posts on front page from" option ?

Started by folkevil, February 07, 2007, 09:45:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

folkevil

 By default, this option has only 5 choicebox



How to increase this option to 10?

Lesmond

You could try this code, it will show the top ten, I used it in a center php block, near the top you will see $what=ssi_recentTopics('10', NULL, 'array'); you can change the 10 to what ever number you like :)

global $scripturl;
$what=ssi_recentTopics('10', NULL, 'array');

echo '<table border="0" width="100%" cellspacing="1" cellpadding="4" class="bordercolor">';
echo '<tr class="catbg3"><td valign="middle" align="left">Subject</td><td valign="middle" align="left">Board</td><td valign="middle" align="center">Last Post by</td><td valign="middle" align="left">Time</td></tr>';

foreach ($what as $topic)
  {
    echo '<tr><td class="windowbg" valign="middle" align="left">', $topic['link'];
    // Is this topic new? (assuming they are logged in!)
    if (!$topic['new'] && $context['user']['is_logged'])
      echo '<a href="', $scripturl, '?topic=', $topic['topic'], '.from', $topic['time'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';
      echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['board']['link'], '</td>';
      echo '</td><td class="windowbg2" valign="middle" align="left">', $topic['poster']['link'], '</td><td class="windowbg2" valign="middle" align="left">';
      if ($settings['images_url'] != $settings['theme_url'] . '/images' || file_exists($settings['theme_dir'] . '/images/icons/last_post.gif'))
      echo '<a href="', $topic['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt[111], '" title="', $txt[111], '" border="0" style="float: right;" /></a>';
      echo '<span class="smalltext">', $topic['time'], '</span></td></tr>';
  }

echo '</table>';

folkevil

Thank you, but i think i don't need this code . I need know how to increase "choicebox", i have too many boards and childboards ( > 10 boards) , and i want display newest posts from these boards on frontpage.  ;D

Lesmond

I see, That I am not to sure as I am not good with code but hopefully someone will come along and help us/me :)

IchBin

#4
$what=ssi_recentTopics('10'NULL'array');

You can change NULL to exclude boards.

Something like this:

$what=ssi_recentTopics('10', array(2,4,5), 'array');

The above code will not take recent topics from the boards 2,4, and 5.

--edit--
Oops.... sorry. I didn't read the first post. I clicked on new post and only saw Lesmonds code. Didn't realize you were talking about the TP Settings. Let me review. :D

basis

hi, i too am looking for a way to increase the number of choice boxes. does anyone have a possible solution?

Thurnok

This question has already been asked previously, and the answer posted.  Here's the post!

basis

Hi Thurnok, thanks for replying but I get this error when I follow the link.

QuoteThe topic or board you are looking for appears to be either missing or off limits to you.

No idea why that occurs.

G6Cad

The thread is archived by Bloc, thats why it's off limits
Dont know why it's in the archive.
But the code Bloc pointed out was this.

Open TPortalAdmin.php and look for thsi code:
// divide the SSI board into 5 boards
$sib=explode(',',$context['TPortal']['SSI_board']);
for($i=0 ; $i<5 ; $i++){
if(isset($sib[$i]))
$context['TPortal']['SSI_board'.($i+1)]=$sib[$i];
else
$context['TPortal']['SSI_board'.($i+1)]='';
}


Correct the number 5 there, to your own.

JPDeni

It needs more than that.

In TPortalAdmin.template.php, find


// board 5
echo '
<select size="1" name="tp_ssiboard5"><option value="0">',$txt['tp-none-'],'</option>';
$tn=sizeof($context['TPortal']['boards']);
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' ,$context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_board5'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}

echo '



and add the following for each board you want to add, changing the numbers for each one


</select> ';

// board 6
echo '
<select size="1" name="tp_ssiboard6"><option value="0">',$txt['tp-none-'],'</option>';
$tn=sizeof($context['TPortal']['boards']);
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' ,$context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_board6'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '



This will actually add the dropdowns to your form.

In TPortalAdmin.php, find



                   elseif($what=='tp_ssiboard1'){
$bo=array();
$bo[0]=$_POST['tp_ssiboard1'];
$bo[1]=$_POST['tp_ssiboard2'];
$bo[2]=$_POST['tp_ssiboard3'];
$bo[3]=$_POST['tp_ssiboard4'];
$bo[4]=$_POST['tp_ssiboard5'];


Add more lines like above to account for the number of boards you want to add. Note that the number of the array is one less than the number of the board, so that the code to add for a 6th board is


$bo[5]=$_POST['tp_ssiboard6'];


And add the code that G6 posted.