News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Ne prikazuje glavnu kategoriju u theme_linktree

Started by Dzungla, December 03, 2010, 06:31:48 AM

Previous topic - Next topic

Dzungla

nece da mi ispise kategoriju u theme_linktree

ispisuje mi ovako

Forum Index - Pricaonica

a pricaonica spada u Zabava

pa bi ovako da izgleda

Forum Index - Zabava - Pricaonica

Dzungla

jos jedan primer

ovako mi sad prikazuje
My Community > General Discussion

a treba ovako da prikaze
My Community > General Category > General Discussion

koristim 1.1.12 verziju smf-a ali je uradjen update na tu verziju

Dzonny

U fajlu Load.php: (linija 656

// Build up the linktree.
$context['linktree'] = array_merge(
$context['linktree'],
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);


i zameni sa ovim:

// Build up the linktree.
$context['linktree'] = array_merge(
$context['linktree'],
array(array(
'url' => $scripturl . '#' . $board_info['cat']['id'],
'name' => $board_info['cat']['name']
)),
array_reverse($board_info['parent_boards']),
array(array(
'url' => $scripturl . '?board=' . $board . '.0',
'name' => $board_info['name']
))
);

Dakle, nov je ovaj array sa board_info[`cat`]....

Dzungla


Dzungla

#4
Ovako je postavljeno u Load.php

Quote// Check for moderators and see if they have access to the board.
function loadBoard()
{
   global $txt, $db_prefix, $scripturl, $context, $modSettings;
   global $board_info, $board, $topic, $ID_MEMBER, $user_info;

   // Assume they are not a moderator.
   $user_info['is_mod'] = false;
   $context['user']['is_mod'] = &$user_info['is_mod'];

   // Start the linktree off empty..
   $context['linktree'] = array();

   // Load this board only if the it is specified.
   if (empty($board) && empty($topic))
   {
      $board_info = array('moderators' => array());
      return;
   }

   if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] == 3))
   {
      // !!! SLOW?
      if (!empty($topic))
         $temp = cache_get_data('topic_board-' . $topic, 120);
      else
         $temp = cache_get_data('board-' . $board, 120);

      if (!empty($temp))
      {
         $board_info = $temp;
         $board = $board_info['id'];
      }
   }

   if (empty($temp))
   {
      $request = db_query("
         SELECT
            c.ID_CAT, b.name AS bname, b.description, b.numTopics, b.memberGroups,
            b.ID_PARENT, c.name AS cname, IFNULL(mem.ID_MEMBER, 0) AS ID_MODERATOR,
            mem.realName" . (!empty($topic) ? ", b.ID_BOARD" : '') . ", b.childLevel,
            b.ID_THEME, b.override_theme, b.permission_mode, b.countPosts
         FROM ({$db_prefix}boards AS b" . (!empty($topic) ? ", {$db_prefix}topics AS t" : '') . ")
            LEFT JOIN {$db_prefix}categories AS c ON (c.ID_CAT = b.ID_CAT)
            LEFT JOIN {$db_prefix}moderators AS mods ON (mods.ID_BOARD = " . (empty($topic) ? $board : 't.ID_BOARD') . ")
            LEFT JOIN {$db_prefix}members AS mem ON (mem.ID_MEMBER = mods.ID_MEMBER)
         WHERE b.ID_BOARD = " . (empty($topic) ? $board : "t.ID_BOARD
            AND t.ID_TOPIC = $topic"), __FILE__, __LINE__);
      // If there aren't any, skip.
      if (mysql_num_rows($request) > 0)
      {
         $row = mysql_fetch_assoc($request);

         // Set the current board.
         if (!empty($row['ID_BOARD']))
            $board = $row['ID_BOARD'];

         // Basic operating information. (globals... :/)
         $board_info = array(
            'id' => $board,
            'moderators' => array(),
            'cat' => array(
               'id' => $row['ID_CAT'],
               'name' => $row['cname']
            ),
            'name' => $row['bname'],
            'description' => $row['description'],
            'num_topics' => $row['numTopics'],
            'parent_boards' => getBoardParents($row['ID_PARENT']),
            'parent' => $row['ID_PARENT'],
            'child_level' => $row['childLevel'],
            'theme' => $row['ID_THEME'],
            'override_theme' => !empty($row['override_theme']),
            'use_local_permissions' => !empty($modSettings['permission_enable_by_board']) && $row['permission_mode'] == 1,
            'permission_mode' => empty($modSettings['permission_enable_by_board']) ? (empty($row['permission_mode']) ? 'normal' : ($row['permission_mode'] == 2 ? 'no_polls' : ($row['permission_mode'] == 3 ? 'reply_only' : 'read_only'))) : 'normal',
            'posts_count' => empty($row['countPosts']),
         );

         // Load the membergroups allowed, and check permissions.
         $board_info['groups'] = $row['memberGroups'] == '' ? array() : explode(',', $row['memberGroups']);

         do
         {
            if (!empty($row['ID_MODERATOR']))
               $board_info['moderators'][$row['ID_MODERATOR']] = array(
                  'id' => $row['ID_MODERATOR'],
                  'name' => $row['realName'],
                  'href' => $scripturl . '?action=profile;u=' . $row['ID_MODERATOR'],
                  'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_MODERATOR'] . '" title="' . $txt[62] . '">' . $row['realName'] . '</a>'
               );
         }
         while ($row = mysql_fetch_assoc($request));

         if (!empty($modSettings['cache_enable']) && (empty($topic) || $modSettings['cache_enable'] == 3))
         {
            // !!! SLOW?
            if (!empty($topic))
               cache_put_data('topic_board-' . $topic, $board_info, 120);
            cache_put_data('board-' . $board, $board_info, 120);
         }
      }
      else
      {
         // Otherwise the topic is invalid, there are no moderators, etc.
         $board_info = array(
            'moderators' => array(),
            'error' => 'exist'
         );
         $topic = null;
         $board = 0;
      }
      mysql_free_result($request);
   }

   if (!empty($topic))
      $_GET['board'] = (int) $board;

   if (!empty($board))
   {
      // Now check if the user is a moderator.
      $user_info['is_mod'] = isset($board_info['moderators'][$ID_MEMBER]);

      if (count(array_intersect($user_info['groups'], $board_info['groups'])) == 0 && !$user_info['is_admin'])
         $board_info['error'] = 'access';

      // Build up the linktree.
      $context['linktree'] = array_merge(
         $context['linktree'],
         array(array(
            'url' => $scripturl . '#' . $board_info['cat']['id'],
            'name' => $board_info['cat']['name']
         )),
         array_reverse($board_info['parent_boards']),
         array(array(
            'url' => $scripturl . '?board=' . $board . '.0',
            'name' => $board_info['name']
         ))
      );
   }

   // Set the template contextual information.
   $context['user']['is_mod'] = &$user_info['is_mod'];
   $context['current_topic'] = $topic;
   $context['current_board'] = $board;

   // Hacker... you can't see this topic, I'll tell you that. (but moderators can!)
   if (!empty($board_info['error']) && ($board_info['error'] != 'access' || !$user_info['is_mod']))
   {
      // The permissions and theme need loading, just to make sure everything goes smoothly.
      loadPermissions();
      loadTheme();

      $_GET['board'] = '';
      $_GET['topic'] = '';

      // If it's a prefetching agent, just make clear they're not allowed.
      if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
      {
         ob_end_clean();
         header('HTTP/1.1 403 Forbidden');
         die;
      }
      elseif ($user_info['is_guest'])
      {
         loadLanguage('Errors');
         is_not_guest($txt['topic_gone']);
      }
      else
         fatal_lang_error('topic_gone', false);
   }

   if ($user_info['is_mod'])
      $user_info['groups'][] = 3;
}

A ovako u index.template.php

Quote// Show a linktree.  This is that thing that shows "My Community | General Category | General Discussion"..
function theme_linktree()
{
   global $context, $settings, $options;

   // Folder style or inline?  Inline has a smaller font.
   echo '<span class="nav"', $settings['linktree_inline'] ? ' style="font-size: smaller;"' : '', '>';

   // Each tree item has a URL and name.  Some may have extra_before and extra_after.
   foreach ($context['linktree'] as $k => $tree)
   {
      // Show the | | |-[] Folders.
      if (!$settings['linktree_inline'])
      {
         if ($k > 0)
            echo str_repeat('<img src="' . $settings['images_url'] . '/icons/linktree_main.gif" alt="| " border="0" />', $k - 1), '<img src="' . $settings['images_url'] . '/icons/linktree_side.gif" alt="|-" border="0" />';
         echo '<img src="' . $settings['images_url'] . '/icons/folder_open.gif" alt="+" border="0" />&nbsp; ';
      }

      if (isset($tree['extra_before']))
         echo $tree['extra_before'];
      echo '<b>', $settings['linktree_link'] && isset($tree['url']) ? '<a href="' . $tree['url'] . '" class="nav">' . $tree['name'] . '</a>' : $tree['name'], '</b>';
      if (isset($tree['extra_after']))
         echo $tree['extra_after'];

      // Don't show a separator for the last one.
      if ($k != count($context['linktree']) - 1)
         echo $settings['linktree_inline'] ? ' &nbsp;|&nbsp; ' : '<br />';
   }

   echo '</span>';
}

Zasto nece da prikaze glavnu kategoruju (General Category) nije mi jasno, instalirao sam sastrane novi SMF 1.1.12 sve normalno radi. :(


Dzungla

#6
Uradio sam Nivo 1 kesiranja ali nista nije ispravio.

a za Nivo 2 i Nivo 3 pise da se ne preporucuje. Nisam cacko bojim se da ne zeznem nesto :(

Founder 2008

Nisam mislio na to nego da nije do tvog racunara. (ali nije sad sam proverio)

Problem je u rewrite linkova. Verovatno si instalirao SEF url mod ili pretty url koji je to poremetio...

Dzungla

imam pretty url ali njega kad ugasim nista opet

kako mogu to da namestim? Ima li resenja?

Founder 2008


Dzungla

instalirao sam taj isti mod na smf 1.1.12 i tamo radi normalno

Founder 2008

Mozda se kosi sa nekom drugom modifikacijom koju si koristio?

Dzungla

koristio sam prettyurls-0-9-3 a sad koristim Pretty URLs 1.0RC2a a trenutna veryija foruma je 1.1.12

Advertisement: