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

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,991
  • Total Topics: 21,323
  • Online today: 633
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 254
  • Total: 254

Setting the forums as the frontpage

Started by leighlife, January 12, 2006, 04:07:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rasyr

Okay, I may have a solution for this, for  TP 0.75 & SMF 1.1 RC1. I have to double check a few things this evening after work and then I will post it if it works in above combo.


Rasyr

#11
Okay, I have this one licked!!

It will require that you make changes to 3 separate files. Here are the changes to make.




First step is to go to the Sources directory, edit TPortal.php and find the following block of code:


   // get articles for frontpage

// first, view the featured article if single-page for frontpage is chosen
if($context['TPortal']['front_type']=='single_page' && $mypage=='' && $mycat=='' && $myrecent==''){
$mypage=$context['TPortal']['featured_article'];
$mycat='';
$myrecent='';
$context['TPortal']['mycat']='';
}


and directly before it, add the following code:


if($context['TPortal']['front_type']=='forum_entry')
$context['noPage'] = 'forum_entry';
else
$context['noPage'] = '';

if ($context['TPortal']['front_type']=='forum_entry' && empty($_REQUEST['action']))
{
if(isset($_GET['board']) || isset($_GET['topic']) || isset($_GET['page']) || isset($_GET['cat']))
$_REQUEST['action'] = '';
else
$_REQUEST['action'] = 'forum';
}






Next, edit TPortalAdmin.template.php, it should be in the Themes|default directory and find the following block of code:


                         <td>
                            <input name="tp_front_type" type="radio" value="forum_only" ' , $context['TPortal']['front_type']=='forum_only' ? 'checked' : '' , '> '.$txt['tp-onlyforum'].'<br />
                            <input name="tp_front_type" type="radio" value="forum_articles" ' , $context['TPortal']['front_type']=='forum_articles' ? 'checked' : '' , '> '.$txt['tp-bothforum'].'<br />
                            <input name="tp_front_type" type="radio" value="articles_only" ' , $context['TPortal']['front_type']=='articles_only' ? 'checked' : '' , '> '.$txt['tp-onlyarticles'].'<br />
                            <input name="tp_front_type" type="radio" value="single_page"  ' , $context['TPortal']['front_type']=='single_page' ? 'checked' : '' , '> '.$txt['tp-singlepage'].'<br />
                            <input name="tp_front_type" type="radio" value="frontblock"  ' , $context['TPortal']['front_type']=='frontblock' ? 'checked' : '' , '> '.$txt['tp-frontblocks'].'<br />
                         </td></tr>



You will want to change it to:


                         <td>
                            <input name="tp_front_type" type="radio" value="forum_only" ' , $context['TPortal']['front_type']=='forum_only' ? 'checked' : '' , '> '.$txt['tp-onlyforum'].'<br />
                            <input name="tp_front_type" type="radio" value="forum_articles" ' , $context['TPortal']['front_type']=='forum_articles' ? 'checked' : '' , '> '.$txt['tp-bothforum'].'<br />
                            <input name="tp_front_type" type="radio" value="articles_only" ' , $context['TPortal']['front_type']=='articles_only' ? 'checked' : '' , '> '.$txt['tp-onlyarticles'].'<br />
                            <input name="tp_front_type" type="radio" value="single_page"  ' , $context['TPortal']['front_type']=='single_page' ? 'checked' : '' , '> '.$txt['tp-singlepage'].'<br />
                            <input name="tp_front_type" type="radio" value="frontblock"  ' , $context['TPortal']['front_type']=='frontblock' ? 'checked' : '' , '> '.$txt['tp-frontblocks'].'<br />
                            <input name="tp_front_type" type="radio" value="forum_entry"  ' , $context['TPortal']['front_type']=='forum_entry' ? 'checked' : '' , '> Forum as Frontpage<br />
                         </td></tr>



You will notice that I did not setup a new $txt string, but just hardcoded "Forum as Frontpage". I did that for my own convienence.  ;D If you want it as a $txt string, it should be relatively easy to set up.




Finally, also in the Themes|default directory, edit the index.template.php file and find the following block of code:


     // Show the [home] and [help] buttons.
       echo '
                     <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'];
       echo '        <a href="', $scripturl, '?action=forum">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/forum.gif" alt="Forum Index" style="margin: 2px 0;" border="0" />' : 'Forum Index'), '</a>', $context['menu_separator'];
       echo '        <a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];



You will want to change it to the following (Note: this is solely for the default Theme, you will have to edit the index.template.php file for any other themes you want to use, and this section (of the template_menu() function) may look differently in other themes):


if ($context['noPage'] == 'forum_entry')
{
       echo '
             <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'];
}
else
{
     // Show the [home] and [help] buttons.
       echo '
                     <a href="', $scripturl, '">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/home.gif" alt="' . $txt[103] . '" style="margin: 2px 0;" border="0" />' : $txt[103]), '</a>', $context['menu_separator'];
       echo '        <a href="', $scripturl, '?action=forum">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/forum.gif" alt="Forum Index" style="margin: 2px 0;" border="0" />' : 'Forum Index'), '</a>', $context['menu_separator'];
}

       echo '        <a href="', $scripturl, '?action=help" target="_blank">', ($settings['use_image_buttons'] ? '<img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/help.gif" alt="' . $txt[119] . '" style="margin: 2px 0;" border="0" />' : $txt[119]), '</a>', $context['menu_separator'];




If you compare the two blocks of code, you will notice that I only added code here, not really changed anything. The same principle should apply to other themes as well.

Now, even with this fix, the linktree that appears above the forums will still include the forumName and then the word Forum and then the board name, etc. when you go into the forums themselves. I am still looking to find out how to fix that portion.. hehe

NOTE: I made a few changes to the above code, specifically to the TPortal.php and index.template.php files. If you are using this code, you will want to update the code accordingly.

Rasyr

Okay, I found a solution for the link tree issue (thanks to Bloc giving me a hint about where to look!!), but I also found a problem in my code. First the solution to the linktree issue.

In Load.php (Sources directory), find the following lines:


        // Start the linktree off empty..not quite, have to insert forum
        $context['linktree'] = array(array('url' => $scripturl . '?action=forum', 'name' => 'Forum'));


change it to:


if ($context['TPortal']['front_type']=='forum_entry' && empty($_REQUEST['action']))
{
        // Start the linktree off empty..not quite, have to insert forum
        $context['linktree'] = array(array('url' => $scripturl . '?action=forum', 'name' => 'Forum'));
}


That removes "Forum" from the linktree.

As to the problem that I found in my code. I found that on some of the pages outside of the forums, the menu would show the Forum button even when it wasn't supposed to. I have updated the code in my previous post (directly above this one) with corrections that fix this issue.


kvanorsdel

Is there a way to do this for SMF 1.0.7 w/TP 0.86

I would really like for the link off my homepage to open directly up to the forum and not the frontpage.

IchBin

You can set in the frontpage settings for 0.86 to only display the forum on the frontpage.

This website is proudly hosted on Crocweb Cloud Website Hosting.