TinyPortal

Development => Support => Topic started by: folkevil on February 07, 2007, 09:45:30 PM

Title: How to increase "Show forum-posts on front page from" option ?
Post by: folkevil on February 07, 2007, 09:45:30 PM
 By default, this option has only 5 choicebox

(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg357.imageshack.us%2Fimg357%2F7631%2Fpostshn3.jpg&hash=72a84dcbc7dccfd35ce82381eb2a357a5197f773)

How to increase this option to 10?
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Lesmond on February 07, 2007, 09:52:14 PM
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>';
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: folkevil on February 07, 2007, 10:00:43 PM
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
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Lesmond on February 07, 2007, 10:13:10 PM
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 :)
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: IchBin on February 07, 2007, 10:17:28 PM
$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
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: basis on April 12, 2007, 06:09:47 AM
hi, i too am looking for a way to increase the number of choice boxes. does anyone have a possible solution?
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Thurnok on April 12, 2007, 07:44:06 AM
This question has already been asked previously, and the answer posted.  Here's the post (http://www.tinyportal.net/index.php?topic=10999.0)!
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: basis on April 12, 2007, 08:17:20 AM
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.
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: G6Cad on April 12, 2007, 11:18:09 AM
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.
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: JPDeni on April 12, 2007, 02:52:37 PM
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.
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: basis on April 12, 2007, 03:20:45 PM
thanks G6 and JPDeni!
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Thurnok on April 13, 2007, 04:20:16 AM
woops.. sorry.. I wasn't paying much attention when I found the post.. hehe
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: basis on April 24, 2007, 02:30:31 AM
ignore. fixed the problem.
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Tommy on May 12, 2007, 01:13:32 PM
Huhu,

is it possible to change the code so that all (new) posts of the forum will be shown on the front page? :)
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: G6Cad on May 12, 2007, 01:27:21 PM
Yes, set the frontpage to "go directly to forum"  ;D
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: Tommy on May 12, 2007, 01:56:57 PM
Pff  ;D Maybe for future releases a 'recent posts' feature for the front page? :)
(I didn't ask for me :P : http://www.tinyportal.net/index.php?topic=15839.msg131899#new )
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: jacintojvc on April 13, 2009, 06:42:44 PM
Thank you very much.

Greetings

Esta genial.

Saludos.
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: evReN_ on August 08, 2009, 07:29:01 PM
How to v1.0 beta 4 please:(
Title: Re: How to increase "Show forum-posts on front page from" option ?
Post by: IchBin on August 08, 2009, 10:38:15 PM
How to what? Please start your own topic, and Please read the Posting Guidelines (http://www.tinyportal.net/index.php/topic,581) so you can supply the required info in order for us to help you.