Login  |  Register
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome, Guest. Please login or register.
Did you miss your activation email?

October 02, 2022, 10:44:57 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 193513
  • Total Topics: 21092
  • Online today: 38
  • Online ever: 3540
  • (September 02, 2022, 06:38:54 PM)
Users Online
Users: 1
Guests: 34
Total: 35

Author Topic: Add more subcategories (or subforums) in index  (Read 9235 times)

0 Members and 1 Guest are viewing this topic.

3nd3r

  • Guest
Add more subcategories (or subforums) in index
« on: March 12, 2007, 04:13:16 AM »
Hi. I'm interested in adding more than five subforums posts to index page.

I've found this in .../Themes/default/TPortalAdmin.template.php

Code: [Select]
echo '
<select size="1" name="tp_ssiboard1">';
$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_board1'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 2
echo '
<select size="1" name="tp_ssiboard2"><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_board2'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 3
echo '
<select size="1" name="tp_ssiboard3"><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_board3'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 4
echo '
<select size="1" name="tp_ssiboard4"><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_board4'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// 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 '
</select> ';

So I add one more "select board":

Code: [Select]
echo '
<select size="1" name="tp_ssiboard1">';
$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_board1'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 2
echo '
<select size="1" name="tp_ssiboard2"><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_board2'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 3
echo '
<select size="1" name="tp_ssiboard3"><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_board3'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 4
echo '
<select size="1" name="tp_ssiboard4"><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_board4'] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// 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 '
</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 '
</select>

And seems to work... But I've got an error log that aren't showed to users:

Code: [Select]
.../index.php?action=tpadmin;sa=frontpage 

8: Undefined index: SSI_board6
Archivo: .../public_html/Themes/default/Admin.template.php (eval?)
Línea: 813

And if I went back to Admin > TP > Config > Index, I see that 6th category exists but was empty.

Well, how can I add more than five subcategories? I think the key is in SSI_board# (where # are the board number to add a subforum), but I'm not a code expert... Any help please?

Offline G6Cad

  • Friends
  • *
  • Posts: 12643
    • FamiljeGodis
Re: Add more subcategories (or subforums) in index
« Reply #1 on: March 12, 2007, 04:43:23 AM »
Seems like you forgot to add the language strings it needs.
Have you checked so you have added the extra text strings to both the english files and then your custom language ?

3nd3r

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #2 on: March 12, 2007, 05:05:17 AM »
Thanks for your quick answer.

What files are you talking about?

JPDeni

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #3 on: March 12, 2007, 05:51:28 AM »
You need to make a change to Sources/TPortalAdmin.php to account for your additional board.

Find
Code: [Select]
$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 the following line to the end of it:

Code: [Select]
$bo[5]=$_POST['tp_ssiboard6'];

You need this code to write the information about the 6th board to the database.

Then, later in the same file find

Code: [Select]
// 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)]='';
}

Change each instance of 5 to 6, so that it looks like

Code: [Select]
// divide the SSI board into 6 boards
$sib=explode(',',$context['TPortal']['SSI_board']);
for($i=0 ; $i<6 ; $i++){
  if(isset($sib[$i]))
    $context['TPortal']['SSI_board'.($i+1)]=$sib[$i];
  else
    $context['TPortal']['SSI_board'.($i+1)]='';
}

You need this code to read the information for the 6th board from the database and to define the index for SSI_board6.

3nd3r

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #4 on: March 12, 2007, 06:25:17 AM »
Thank you very much!!  :up:

I knew that it could be done!

Works perfect and no errors!  :) In fact, I add 9 subcategories  ;) Seems to be OK!

JPDeni

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #5 on: March 12, 2007, 07:33:30 AM »
You're welcome. :)

Theoretically, you could add a hundred. It would just start to slow things down.

3nd3r

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #6 on: May 18, 2007, 02:03:25 AM »
Well, I updated to TP 0.9.8. Did same changes, but it's not working...

Any ideas?

Thanks in advance for your time

3nd3r

  • Guest
Re: Add more subcategories (or subforums) in index
« Reply #7 on: May 18, 2007, 05:43:17 AM »
Fixed. Missed modification for TPortalAdmin.template.php

Sorry

Offline metalmaragato

  • Jr. Member
  • **
  • Posts: 6
Re: Add more subcategories (or subforums) in index
« Reply #8 on: August 27, 2010, 02:45:09 PM »
in TP 1.0 beta 5-1 dont work :'(

TPortalAdmin.php dont have the code

Code: [Select]
$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'];

and neither this code

Code: [Select]
// 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)]='';
}

I find the code in TPortalAdmin.template.php but without the correct code in TPortalAdmin.php, I think dont work  :-[

Code: [Select]
echo '
<select size="1" name="tp_ssiboard1">';
$tn=sizeof($context['TPortal']['boards']);
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' , isset($context['TPortal']['SSI_boards'][0]) && $context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_boards'][0] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 2
echo '
<select size="1" name="tp_ssiboard2"><option value="0">',$txt['tp-none-'],'</option>';
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' , isset($context['TPortal']['SSI_boards'][1]) && $context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_boards'][1] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 3
echo '
<select size="1" name="tp_ssiboard3"><option value="0">',$txt['tp-none-'],'</option>';
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' , isset($context['TPortal']['SSI_boards'][2]) && $context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_boards'][2] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 4
echo '
<select size="1" name="tp_ssiboard4"><option value="0">',$txt['tp-none-'],'</option>';
for($n=0 ; $n<$tn; $n++){
echo '
<option value="'.$context['TPortal']['boards'][$n]['id'].'" ' , isset($context['TPortal']['SSI_boards'][3]) && $context['TPortal']['boards'][$n]['id']==$context['TPortal']['SSI_boards'][3] ? 'selected' : '' , '>'.$context['TPortal']['boards'][$n]['name'].'</option>';
}
echo '
</select> ';
// board 5
echo '
<select size="1" name="tp_ssiboard5"><option value="0">',$txt['tp-none-'],'</option>';
for($n=0 ; $n<$tn; $n++){
echo '

Someone can help me?

I do a post here with
[HELP] Increse the "forum-posts on frontpage from:" 5 to 10 (1.0 beta 5-1)
« Last Edit: August 27, 2010, 05:27:47 PM by metalmaragato »

Offline metalmaragato

  • Jr. Member
  • **
  • Posts: 6
Re: Add more subcategories (or subforums) in index
« Reply #9 on: August 29, 2010, 06:37:51 AM »
Here is the solution for TP 1.0 beta 5-1
Code: [Select]
http://www.tinyportal.net/index.php?topic=33155.msg265934#msg265934