TinyPortal

Development => Support => Topic started by: xadio on February 11, 2006, 10:59:24 PM

Title: Where are settings saved?
Post by: xadio on February 11, 2006, 10:59:24 PM
I am working on a hack and I am working on adding options in the admin menu to turn it on and off.
I have the following in TPortalAdmin.template.php:

                      <tr class="windowbg2">
                        <td align="right" width="45%">'.$txt['tp-showchildrenboards'].'</td>
                        <td>
                          <input name="tp_show_children_boards" type="radio" value="0" ' , $context['TPortal']['show_children_boards']==0 ? 'checked' : '' , '> '.$txt['tp-no'].'
                          <input name="tp_show_children_boards" type="radio" value="1" ' , $context['TPortal']['show_children_boards']==1 ? 'checked' : '' , '> '.$txt['tp-yes'].'
                        </td>
                      </tr>
                      <tr class="windowbg2">
                        <td align="right" width="45%">'.$txt['tp-showboardname'].'</td>
                        <td>
                          <input name="tp_show_board_name" type="radio" value="0" ' , $context['TPortal']['show_board_name']==0 ? 'checked' : '' , '> '.$txt['tp-no'].'
                          <input name="tp_show_board_name" type="radio" value="1" ' , $context['TPortal']['show_board_name']==1 ? 'checked' : '' , '> '.$txt['tp-yes'].'
                        </td>
                      </tr>


And the following in TPortalAdmin.php:

//-- START: Show Childern Boards Hack --//
                   elseif($what=='tp_show_children_boards'){
                       db_query("UPDATE {$tp_prefix}settings SET value='$value' WHERE name='show_children_boards'", __FILE__, __LINE__);
                       $go=6;
                   }
                   //-- END: Show Childern Boards Hack --//
                   //-- START: Show Board Names Hack --//
                   elseif($what=='tp_show_board_name'){
                       db_query("UPDATE {$tp_prefix}settings SET value='$value' WHERE name='show_board_name'", __FILE__, __LINE__);
                       $go=6;
                   }
                   //-- END: Show Board Names Hack --//


But I am unsure of where the following would be set:

$context['TPortal']['show_children_boards']
$txt['tp-showchildrenboards']


Thanks in advance!
Title: Re: Where are settings saved?
Post by: bloc on February 12, 2006, 01:35:50 AM
Well, any $context values needs to be filled within TPortalAdmin.php, while the $txt entries needs to go into TPortalAdmin.language.php.
Title: Re: Where are settings saved?
Post by: xadio on February 12, 2006, 02:11:10 AM
Alright thanks Bloc!
Title: Re: Where are settings saved?
Post by: xadio on February 12, 2006, 02:20:07 AM
Hey here is another question... when tp is going to output "Both forum and articles - sorted on date" in

if ($output_method != 'echo')
                return $return;

        foreach ($return as $news)
        {
                echo '
                        <table border="0" width="100%" align="center" class="ssi_table">
                                <tr>
                                        <td>', $news['icon'], ' <b>'$news['subject'], '</b><span class="smaller"><br />', $news['time'], ' ', $txt[525], ' ', $news['poster']['link'], '<br /><br /></span></td>
                                </tr>
                                <tr>
                                        <td>', $news['body'], '<br /><br /></td>
                                </tr>
                                <tr>
                                        <td>', $news['link'], ' | ', $news['new_comment'], '</td>
                                </tr>
                        </table>
                        <br />';

                if (!$news['is_last'])
                        echo '
                        <hr width="100%" />
                        <br />';
        }


does it use the above echo or is it returned in $output_method != 'echo';?

Thanks a bunch!

Oh and when I finish my hack where is a good place to post it?
Title: Re: Where are settings saved?
Post by: xadio on February 12, 2006, 06:08:44 AM
I finished it!  Thanks for all your help bloc!  If anyone is curious what my hack does it can be viewed at http://www.teamgouranga.com

When I get time I will create a guide on how to do it.



[attachment deleted by admin]