Advertisement:

Author Topic: Redirect boards?  (Read 3834 times)

Offline Angelotus

  • Sr. Member
  • ****
  • Posts: 881
  • Gender: Male
    • Weeklyfun.nl | The Dutch Society of Fun
Redirect boards?
« on: July 31, 2008, 09:49:56 AM »
Hi, this is the code I use for my boardindex.template.php:
 
Code: [Select]
function template_main()
{
   global $context, $settings, $options, $txt, $scripturl, $modSettings;
   echo '<table class="collapse"><tr><td valign="top" align="left">';
   //Display ads on the board index
   if (function_exists("show_boardAds"))
   {
      $ads = show_boardAds();
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }
   
   
 
 
 /* Each category in categories is made up of:
   id, href, link, name, is_collapsed (is it collapsed?), can_collapse (is it okay if it is?),
   new (is it new?), collapse_href (href to collapse/expand), collapse_image (up/down image),
   and boards. (see below.) */
   $first = true;
   foreach ($context['categories'] as $category)
   {
      echo '
   <div class="tborder" style="margin-top: ' , $first ? '0;' : '1ex;' , '' , $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'width: 100%;' : '', '">
      <div class="catbg', $category['new'] ? '2' : '', '"><table class="collapse"><tr>';
      $first = false;
      // If this category even can collapse, show a link to collapse it.
     
      echo '
             <td valign="middle" align="left">', $category['link'], '</td>';
         if ($category['can_collapse'])
         echo '
            <td valign="middle" align="right"><a href="', $category['collapse_href'], '">-+</a></td>';
      echo '</tr></table></div>';
      // Assuming the category hasn't been collapsed...
      if (!$category['is_collapsed'])
      {
         echo '
      <table class="collapse"><tr class="titlebg"><td width="6%"></td><td>Forum en omschrijving</td><td align="center">Topics</td><td align="center">Reacties</td><td colspan="2">Laatste Post</td></tr>';
         /* Each board in each category's boards has:
         new (is it new?), id, name, description, moderators (see below), link_moderators (just a list.),
         children (see below.), link_children (easier to use.), children_new (are they new?),
         topics (# of), posts (# of), link, href, and last_post. (see below.) */
         foreach ($category['boards'] as $board)
         {
            echo '
         <tr>
            <td ' , !empty($board['children']) && !$modSettings['display_childboards'] && !$modSettings['disable_avatar'] ? 'rowspan="2"' : '1' , ' class="forum_bg1" width="6%" align="center" valign="top"><a href="', $scripturl, '?action=unread;board=', $board['id'], '.0">';
            // If the board is new, show a strong indicator.
            if ($board['new'])
               echo '<img src="', $settings['images_url'], '/on.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
            // This board doesn't have new posts, but its children do.
            elseif ($board['children_new'])
               echo '<img src="', $settings['images_url'], '/on2.gif" alt="', $txt[333], '" title="', $txt[333], '" />';
            // No new posts at all! The agony!!
            else
               echo '<img src="', $settings['images_url'], '/off.gif" alt="', $txt[334], '" title="', $txt[334], '" />';
            echo '</a>
            </td>
            <td onmouseover="this.style.backgroundColor=\'#eeeeee\';" onmouseout="this.style.backgroundColor=\'transparent\';" class="forum_bg1-1" valign="top">
               <b><a href="', $board['href'], '" name="b', $board['id'], '">', $board['name'], '</a></b> (<a href="' . $scripturl . '?action=.xml;board=' . $board['id'] . ';type=rss">rss</a>)<br />
                  ', $board['description'];
            // Show the "Moderators: ". Each has name, href, link, and id. (but we're gonna use link_moderators.)
            if (!empty($board['moderators']))
               echo '
               <div style="padding-top: 1px;" class="smalltext"><i>Moderators: ', implode(', ', $board['link_moderators']), '</i></div>';
            // Show some basic information about the number of posts, etc.
               echo '
            </td>
            <td class="forum_bg1-1" valign="top" align="center" width="10%"><span>
               ', $board['topics'],'</span></td>
<td class="forum_bg1-1" valign="top" align="center" width="10%"><span>
               ', $board['posts'], '</td>
               
            </span></td>';
            if (!$modSettings['disable_avatar'])
               echo '
            <td width="', $modSettings['board_avatar_width'] ? $modSettings['board_avatar_width'] : '1','" class="forum_bg1-1" valign="top" align="center">
               ', $board['last_post']['member']['avatar'], '
            </td>';
               echo '
            <td class="forum_bg1-1" valign="top" width="22%">
               <span class="smalltext">';
            /* The board's and children's 'last_post's have:
            time, timestamp (a number that represents the time.), id (of the post), topic (topic id.),
            link, href, subject, start (where they should go for the first unread post.),
            and member. (which has id, name, link, href, username in it.) */
            if (!empty($board['last_post']['id']))
               echo '
                  <b>', $txt[22], '</b>  ', $txt[525], ' ', $board['last_post']['member']['link'] , '<br />
                  ', $txt['smf88'], ' ', $board['last_post']['link'], '<br />
                  ', $txt[30], ' ', $board['last_post']['time'];
            echo '
               </span>
            </td>
         </tr>';
            // Show the "Child Boards: ". (there's a link_children but we're going to bold the new ones...)
            if (!empty($board['children']) && !$modSettings['display_childboards'])
            {
               // Sort the links into an array with new boards bold so it can be imploded.
               $children = array();
               /* Each child in each board's children has:
                     id, name, description, new (is it new?), topics (#), posts (#), href, link, and last_post. */
               foreach ($board['children'] as $child)
               {
                     $child['link'] = '<a href="' . $child['href'] . '" title="' . ($child['new'] ? $txt[333] : $txt[334]) . ' (' . $txt[330] . ': ' . $child['topics'] . ', ' . $txt[21] . ': ' . $child['posts'] . ')">' . $child['name'] . '</a>';
                     $children[] = $child['new'] ? '<b>' . $child['link'] . '</b>' : $child['link'];
            }
               echo '
         <tr>
            <td colspan="', !$modSettings['display_childboards'] ? '5' : '1', '" class="forum_bg1-1', !empty($settings['seperate_sticky_lock']) ? '3' : '', '">
               <div class="smalltext"><b>', $txt['parent_boards'], '</b>:<br />', implode(', ', $children), '</div>
            </td>
         </tr>';
            }
         }
         echo '
      </table>';
      }
      echo '
   </div>';
   
 
 
 

   //Display ads Between cats
   if (function_exists("show_category"))
   {
      $ads = show_category($category['id']);
      if(!empty($ads))
         if($ads['type']==0)
            echo $ads['content'];
         else
            eval($ads['content']);
      unset($ads);
   }
   }
   
 
 
 
 
 
 
 
 
 
 
 
 
 
 
if ($context['user']['is_logged'])
   {
      echo '
   <table class="collapse">
      <tr>
         <td align="', !$context['right_to_left'] ? 'left' : 'right', '" class="smalltext">
            <img src="' . $settings['images_url'] . '/new_some.gif" alt="" align="middle" /> ', $txt[333], '
            <img src="' . $settings['images_url'] . '/new_none.gif" alt="" align="middle" style="margin-left: 4ex;" /> ', $txt[334], '
         </td>
         <td align="', !$context['right_to_left'] ? 'right' : 'left', '">';
      // Mark read button.
      $mark_read_button = array('markread' => array('text' => 452, 'image' => 'markread.gif', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=all;sesc=' . $context['session_id']));
      // Show the mark all as read button?
      if ($settings['show_mark_read'] && !empty($context['categories']))
            echo '
            <table cellpadding="0" cellspacing="0" border="0" style="position: relative; top: -5px;">
               <tr>
                      ', template_button_strip($mark_read_button, 'top'), '
               </tr>
            </table>';
      echo '
         </td>
      </tr>
   </table>';
   }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 // Here's where the "Info Center" starts...
   echo '<br />
   <div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;"' : '', '>
      <div class="catbg" style="padding: 6px; vertical-align: middle; text-align: center; ">
         <a href="#" onclick="shrinkHeaderIC(!current_header_ic); return false;"><img id="upshrink_ic" src="', $settings['images_url'], '/', empty($options['collapse_header_ic']) ? 'collapse.gif' : 'expand.gif', '" alt="*" title="', $txt['upshrink_description'], '" style="margin-right: 2ex;" align="right" /></a>
         Infocentrum
      </div>
      <div id="upshrinkHeaderIC"', empty($options['collapse_header_ic']) ? '' : ' style="display: none;"', '>
         <table class="collapse">';
      // Show information about events, birthdays, and holidays on the calendar.
   if ($context['show_calendar'])
   {
      echo '
            <tr>
               <td class="titlebg" colspan="2">', $context['calendar_only_today'] ? $txt['calendar47b'] : $txt['calendar47'], '</td>
            </tr><tr>
               <td class="windowbg" width="20" valign="middle" align="center">
                  <a href="', $scripturl, '?action=calendar"><img src="', $settings['images_url'], '/icons/calendar.gif" alt="', $txt['calendar24'], '" /></a>
               </td>
               <td class="windowbg2" width="100%">
                  <span class="smalltext">';
      // Holidays like "Christmas", "Chanukah", and "We Love [Unknown] Day" :P.
      if (!empty($context['calendar_holidays']))
            echo '
                     <span style="color: #', $modSettings['cal_holidaycolor'], ';">', $txt['calendar5'], ' ', implode(', ', $context['calendar_holidays']), '</span><br />';
      // People's birthdays. Like mine. And yours, I guess. Kidding.
      if (!empty($context['calendar_birthdays']))
      {
            echo '
                     <span style="color: #', $modSettings['cal_bdaycolor'], ';">', $context['calendar_only_today'] ? $txt['calendar3'] : $txt['calendar3b'], '</span> ';
      /* Each member in calendar_birthdays has:
            id, name (person), age (if they have one set?), is_last. (last in list?), and is_today (birthday is today?) */
      foreach ($context['calendar_birthdays'] as $member)
            echo '
                     <a href="', $scripturl, '?action=profile;u=', $member['id'], '">', $member['is_today'] ? '<b>' : '', $member['name'], $member['is_today'] ? '</b>' : '', isset($member['age']) ? ' (' . $member['age'] . ')' : '', '</a>', $member['is_last'] ? '<br />' : ', ';
      }
      // Events like community get-togethers.
      if (!empty($context['calendar_events']))
      {
         echo '
                     <span style="color: #', $modSettings['cal_eventcolor'], ';">', $context['calendar_only_today'] ? $txt['calendar4'] : $txt['calendar4b'], '</span> ';
         /* Each event in calendar_events should have:
               title, href, is_last, can_edit (are they allowed?), modify_href, and is_today. */
         foreach ($context['calendar_events'] as $event)
            echo '
                     ', $event['can_edit'] ? '<a href="' . $event['modify_href'] . '" style="color: #FF0000;">*</a> ' : '', $event['href'] == '' ? '' : '<a href="' . $event['href'] . '">', $event['is_today'] ? '<b>' . $event['title'] . '</b>' : $event['title'], $event['href'] == '' ? '' : '</a>', $event['is_last'] ? '<br />' : ', ';
         // Show a little help text to help them along ;).
         if ($context['calendar_can_edit'])
            echo '
                     (<a href="', $scripturl, '?action=helpadmin;help=calendar_how_edit" onclick="return reqWin(this.href);">', $txt['calendar_how_edit'], '</a>)';
      }
      echo '
                  </span>
               </td>
            </tr>';
   }

   // Show YaBB SP1 style information...
   if ($settings['show_sp1_info'])
   {
      echo '
            <tr>
               <td class="titlebg" colspan="2">', $txt[645], '</td>
            </tr>
            <tr>
               <td class="windowbg" width="20" valign="middle" align="center">
                  <a href="', $scripturl, '?action=stats"><img src="', $settings['images_url'], '/icons/info.gif" alt="', $txt[645], '" /></a>
               </td>
               <td class="windowbg2" width="100%">
                  <span class="middletext">
                     ', $context['common_stats']['total_posts'], ' ', $txt[95], ' ', $txt['smf88'], ' ', $context['common_stats']['total_topics'], ' ', $txt[64], ' ', $txt[525], ' ', $context['common_stats']['total_members'], ' ', $txt[19], '. ', $txt[656], ': <b> ', $context['common_stats']['latest_member']['link'], '</b>
                     <br /> ' . $txt[659] . ': <b>"' . $context['latest_post']['link'] . '"</b>  ( ' . $context['latest_post']['time'] . ' )<br />
                     <a href="', $scripturl, '?action=recent">', $txt[234], '</a>', $context['show_stats'] ? '<br />
                     <a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
                  </span>
               </td>
            </tr>';
   }
   // "Users online" - in order of activity.
   echo '
            <tr>
               <td class="titlebg" colspan="2">Gebruikers online</td>
            </tr><tr>
               <td rowspan="2" class="windowbg" width="20" valign="middle" align="center">
                  ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', '<img src="', $settings['images_url'], '/icons/online.gif" alt="', $txt[158], '" />', $context['show_who'] ? '</a>' : '', '
               </td>
               <td class="windowbg2" width="100%">';
   echo '
                  ', $context['show_who'] ? '<a href="' . $scripturl . '?action=who">' : '', $context['num_guests'], ' ', $context['num_guests'] == 1 ? $txt['guest'] : $txt['guests'], ', ' . $context['num_users_online'], ' ', $context['num_users_online'] == 1 ? $txt['user'] : $txt['users'];
   // Handle hidden users and buddies.
   if (!empty($context['num_users_hidden']) || ($context['show_buddies'] && !empty($context['show_buddies'])))
   {
      echo ' (';
      // Show the number of buddies online?
      if ($context['show_buddies'])
         echo $context['num_buddies'], ' ', $context['num_buddies'] == 1 ? $txt['buddy'] : $txt['buddies'];
      // How about hidden users?
      if (!empty($context['num_users_hidden']))
         echo $context['show_buddies'] ? ', ' : '', $context['num_users_hidden'] . ' ' . $txt['hidden'];
      echo ')';
   }
   echo $context['show_who'] ? '</a>' : '', '
                  <div class="smalltext">';
   // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
   if (!empty($context['users_online']))
      echo '
                     Online:<br />', implode(', ', $context['list_users_online']);
   echo '
                     <br />
                     ', $context['show_stats'] && !$settings['show_sp1_info'] ? '<a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
                  </div>
               </td>
            </tr>';
         if (!empty($modSettings['arrange_mclegend']))
         {
            echo '
            <tr>
               <td class="windowbg2" width="100%">
                  <span class="smalltext">';
                  foreach($context['mcl_group'] AS $key => $dummy)
                     for ($i = 0; $i < count($context['mc_legend']); $i++)   
                       if ($context['mc_legend'][$i]['id'] == $context['mcl_group'][$key])
                           echo '[', $context['mc_legend'][$i]['link'], ']  ';
                     echo '
                  </span>
               </td>
            </tr>';
         }
            echo '
            <tr>
               <td class="windowbg2" width="100%">
                  <span class="middletext">
                     ', $txt['most_online_today'], ': <b>', $modSettings['mostOnlineToday'], '</b>.
                     ', $txt['most_online_ever'], ': ', $modSettings['mostOnline'], ' (' , timeformat($modSettings['mostDate']), ')
                  </span>
               </td>
            </tr>';
   // Users online today
   echo '
   <tr>
      <td class="titlebg" colspan="2">Gebruikers online vandaag</td>
   </tr><tr>
      <td class="windowbg" width="20" valign="middle" align="center">
         <img src="', $settings['images_url'], '/icons/online.gif" alt="vandaag online" border="0" />
      </td>
      <td class="windowbg2" width="100%">';
   echo '
         <div class="smalltext">';
  echo 'Totaal: <b>', $context['num_users_online_today'], '</b>';
  if (!$context['user']['is_guest'])
     echo ' (zichtbaar: ', ($context['num_users_online_today'] - $context['num_hidden_users_online_today']), ', verborgen: ', $context['num_hidden_users_online_today'], ')';
   // Assuming there ARE users online... each user in users_online has an id, username, name, group, href, and link.
   if (!empty($context['users_online_today']) && !$context['user']['is_guest'])
      echo '<br />', implode(', ', $context['list_users_online_today']);
   echo '
            <br />', $context['show_stats'] && !$settings['show_sp1_info'] ? '
            <a href="' . $scripturl . '?action=stats">' . $txt['smf223'] . '</a>' : '', '
         </div>
      </td>
   </tr>';
         
   
 

   echo '
         </table>
      </div>
   </div>';
echo '</td></tr></table>';
}
?>

What part do I have to edit so that if I have a board that redirects to a site it says the no. of redirects instead of no. of replies???

Offline Deprecated

  • SMF Hero
  • ******
  • Posts: 3,499
Re: Redirect boards?
« Reply #1 on: July 31, 2008, 09:59:16 AM »
What part do I have to edit so that if I have a board that redirects to a site it says the no. of redirects instead of no. of replies???

Maybe I'm misunderstanding you. I'm running 2.0b3.1 and I've got one category section set up as a redirect to my contact form. The forum index shows the number of redirects, how many times somebody has taken the link to my contact form.

It should be the same if you redirect to any URL. How is this different from what you want to do? If it's the same then all you need to do is configure your section for redirection. No bit mashing required.

But I must misunderstand, and apologize for that. It can't be that simple, can it?

Offline Angelotus

  • Sr. Member
  • ****
  • Posts: 881
  • Gender: Male
    • Weeklyfun.nl | The Dutch Society of Fun
Re: Redirect boards?
« Reply #2 on: July 31, 2008, 03:21:13 PM »
No it can't. I have a modified version of boardindex.template.php
Please take a look at http://forum.weeklyfun.nl
In the category 'Algemeen' there is a board called 'WF Galery' wich is redirected to the galery. Next to the description of the boards you see in the column 'Topics' it says 0 (zero) and in the column 'Posts' it says the nr of redirects. I want instead of 2 columns i want 1 column with the nr of redirects and the actual word 'redirect'.

Offline Deprecated

  • SMF Hero
  • ******
  • Posts: 3,499
Re: Redirect boards?
« Reply #3 on: July 31, 2008, 04:13:11 PM »
I'm sorry. The theme is too different from what I'm used to, and the language poses a problem for me. In the default theme I have just one column for posts and topics, and in my forwarded board it just says "nnn redirects" where nnn is the number.

I'm going to just confuse us both and waste your time, so I hope a more experienced person will come along and help your topic soon! :)

Offline Angelotus

  • Sr. Member
  • ****
  • Posts: 881
  • Gender: Male
    • Weeklyfun.nl | The Dutch Society of Fun
Re: Redirect boards?
« Reply #4 on: July 31, 2008, 05:02:35 PM »
Thanks for replying anyway! :)

Offline metallica48423

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 19,842
  • Gender: Male
  • Professional Multislacker!
    • Zentendo
Re: Redirect boards?
« Reply #5 on: August 01, 2008, 10:36:12 AM »
can you post your BoardIndex.template.php?
Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

Quote
Microsoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you   
Search
Settings Repair Tool
     

Offline Angelotus

  • Sr. Member
  • ****
  • Posts: 881
  • Gender: Male
    • Weeklyfun.nl | The Dutch Society of Fun
Re: Redirect boards?
« Reply #6 on: August 01, 2008, 06:27:36 PM »
yes, see code in first post

Offline Rumbaar

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 15,805
  • Gender: Male
  • Inherent Omniscience
    • Rumbaar.net
Re: Redirect boards?
« Reply #7 on: August 06, 2008, 06:42:39 AM »
As this is a default feature of 2.x, why don't you look at the default CORE BoardIndex.template.php file and see how it's done there?
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]