News:

Wondering if this will always be free?  See why free is better.

Main Menu

[1.1] How to add tabs to Core (NDT)?

Started by JayBachatero, December 31, 2005, 04:21:57 PM

Previous topic - Next topic

E-World

Hi i have just added a new tab to link to my torrents site, but how do i make it like the rest?
hxxp:e-worldforums.co.nr [nonactive]

shumar

#421
hm...
How to make to call correctly one of PHP articles in TP ? With highlighting...
I give up on this and try something else, but I need help. :)

Can I make halloffame.php which will call halloffame.template.php with this code and then call that file ?
But problem is how to do that..
I put in Sources halloffame.php with this code:


<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
halloffame() {
// This is gonna be needed...
loadTemplate('halloffame');
}


and make halloffame.template.php in /Themes/default/

<?php
 
global $txt$scripturl$user_info$context$modSettings$ID_MEMBER$board_info$settings$db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(1312,);
////////////////////////////////////////

$list_by_group true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups false;      // 'true' to include post-count based group in membership search
$include_moderators false;      // 'true' to include board moderators on page
$repeats_allowed false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix '';      // text to append to member's name in link label for extra link

$page_title 'Hall of Fame';
$page_subtitle 'Članovi grupe na koje smo posebno ponosni';

$moderator_group 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord 'mem.ID_MEMBER ASC';
if (
$sort_by == 'posts'$sort_ord 'mem.posts DESC';
if (
$sort_by == 'name'$sort_ord 'mem.realName ASC';

if ((
$extra_type != 'board') && ($extra_type != 'page')) $extra_type 'none';

if (
$include_moderators)
   {if (!
in_array($moderator_group$groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if (
$list_by_group)
   {
$groups_to_use $groups_list;}
else
   {
$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo 
'<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">'
$page_title'</h2>
   <span class="smalltext"><h3 align="center">'
$page_subtitle'</h3></span>
</td></tr>'
;

if (!
$list_by_group)
   echo 
'<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>'
;

foreach(
$groups_to_use as $groupnumber)
{
   
$loaded_ids = array();
   
$user_profile=array();
   
$memberContext=array();
   
$profile=array();
   
$context['TPortal']['team']=array();
  
   
// get the name of the group
   
$request db_query("
      SELECT groupName FROM 
{$db_prefix}membergroups WHERE ID_GROUP=$groupnumber"__FILE____LINE__);
   if(
mysql_num_rows($request)>0){
      
$row mysql_fetch_row($request);
      
$groupNameX=$row[0];
      
mysql_free_result($request);
   }

   if (
$list_by_group) {
      
$select_where 'mem.ID_GROUP = '.$groupnumber;
      if (
$include_nonprimary_groups$select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if (
$include_post_groups$select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if (
$include_moderators && ($groupnumber == $moderator_group)) $select_where 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      
$select_where 'mem.ID_GROUP IN (' implode(', '$groups_list) . ')';
      if (
$include_nonprimary_groups$select_where .= ' OR FIND_IN_SET(' implode(', mem.additionalGroups) OR FIND_IN_SET('$groups_list) . ', mem.additionalGroups)';
      if (
$include_post_groups$select_where .= ' OR mem.ID_POST_GROUP IN (' implode(', '$groups_list) . ')';
      if (
$include_moderators$select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   
$select_where '(' $select_where ') AND mem.ID_MEMBER NOT IN (' implode(', '$users_already_listed) . ')';

   
// Load the member's data.
   
$request db_query("
      SELECT   IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
         mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS CP4, m.ID_MEMBER as modmem, g.groupName
      FROM (
{$db_prefix}members AS mem)
         LEFT JOIN 
{$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         LEFT JOIN 
{$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'CP4' AND them.ID_THEME=1)
      WHERE 
$select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY 
$sort_ord"__FILE____LINE__);
   
$new_loaded_ids = array();
   
$member_count 0;

   while (
$row mysql_fetch_assoc($request))
   {
      if (!
$repeats_allowed$users_already_listed[$row['memnum']] = $row['memnum'];

      
$member_count += 1;

      
$avatar_width '';
      
$avatar_height '';
      if(
$context['browser']['is_ie6']) $avatar_width 'width="' $modSettings['avatar_max_width_external'] . '"';

      
$context['TPortal']['team'][] = array(
         
'username' => $row['memberName'],
         
'usertitle' => $row['usertitle'],
         
'name' => $row['realName'],
         
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
         
'posts' => $row['posts'],
         
'karmabad' => $row['karmaBad'],
         
'karmagood' => $row['karmaGood'],
         
'location' => $row['location'],
         
'href' => $scripturl '?action=profile;u=' $row['memnum'],
         
'link' => '<a href="' $scripturl '?action=profile;u=' $row['memnum'] . '" title="' $txt[92] . ' ' $row['realName'] . '">' $row['realName'] . '</a>',
         
'blurb' => $row['personalText'],
         
'avatar' => array(
            
'name' => $row['avatar'],
            
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > '<img  src="' . (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['ID_ATTACH'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' '') : (stristr($row['avatar'], 'http://') ? '<img src="' $row['avatar'] . '"' $avatar_width $avatar_height ' alt="" style="max-height:280px;max-width:180px;" border="0" />' '<img src="' $modSettings['avatar_url'] . '/' htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
            
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > ? (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['ID_ATTACH'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']),
            
'url' => $row['avatar'] == '' '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar'])
         ),
         
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
         
'last_login_timestamp' => empty($row['lastLogin']) ? forum_time(0$row['lastLogin']),
         
'website' => array(
            
'title' => $row['websiteTitle'],
            
'url' => $row['websiteUrl']
         ),
         
'online' => array(
            
'is_online' => $row['isOnline'],
            
'text' => &$txt[$row['isOnline'] ? 'online2' 'online3'],
            
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' 'useroff') . '.gif',
         ),
         
'CP4' => $row['CP4'],
         
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' $extra_links[$row['memnum']],
      );

   }
   
mysql_free_result($request);

   if (
$member_count 0)
   {
      if (
$list_by_group)
      echo 
'<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' 
$groupNameX '</h2>
         </td></tr>'
;

      echo 
'<tr>';
           
$newrow=0;

      foreach(
$context['TPortal']['team'] as $team)
           {
         echo 
'
            <td valign="top" width="18%">'
.$team['avatar']['image'].'</td>';

         echo 
'   <td valign="top" class="middletext" style="padding: 2px;">';

            echo 
'<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

//            echo ''. $team['usertitle'].'
//';

//            if (!$list_by_group)
//               echo ''.$txt[87].': '.$team['groupname'].'
//';

            
if ($modSettings['karmaMode'] == '1')
               echo 
''$modSettings['karmaLabel'], ' '$team['karmagood'] - $team['karmabad'], '
'
;
            elseif (
$modSettings['karmaMode'] == '2')
               echo 
''$modSettings['karmaLabel'], ' +'$team['karmagood'], ' | -'$team['karmabad'], '
'
;

//            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
//';



//            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
//' : '';

//          echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
//' : '';


//            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
//' : '';

            
echo !empty($team['CP4']) ? $team['CP4'].'
'';

            if ((
$extra_type == 'board') && !empty($team['member_page']))
               echo 
'<a href="' $scripturl '?board=' $team['member_page'] . '">'$extra_label_prefix $team['name'] . $extra_label_suffix '</a>
'
;
            if ((
$extra_type == 'page') && !empty($team['member_page']))
               echo 
'<a href="' $scripturl '?page=' $team['member_page'] . '">'$extra_label_prefix $team['name'] . $extra_label_suffix '</a>
'
;

         echo 
'
            </td>'
;

         
$newrow++;
         if(
$newrow>1){
            
$newrow=0;
            echo 
'</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if(
$newrow=1) echo '<td colspan="2"></td>';
      echo 
'</tr>';
   }

}
echo 
'</table>';
?>


Also I make changes in index.template:

if (in_array($context['current_action'], array('gallery', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'invite', 'forum', 'tpadmin', 'halloffame')))


//Hall of fame menu button
if ($context[$current_action == 'halloffame'])
$current_action = 'halloffame';
echo ($current_action=='halloffame' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'halloffame' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=halloffame">Hall of Fame</a>
</td>' , $current_action == 'halloffame' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

but how to make that correct file is called when I click on link ?


unrelenting

Quote from: shumar on March 17, 2008, 05:08:51 PM
hm...
How to make to call correctly one of PHP articles in TP ? With highlighting...
I give up on this and try something else, but I need help. :)

Can I make halloffame.php which will call halloffame.template.php with this code and then call that file ?
But problem is how to do that..
I put in Sources halloffame.php with this code:


<?php
if (!defined('SMF'))
die('Hacking attempt...');

function 
halloffame() {
// This is gonna be needed...
loadTemplate('halloffame');
}


and make halloffame.template.php in /Themes/default/

<?php
 
global $txt$scripturl$user_info$context$modSettings$ID_MEMBER$board_info$settings$db_prefix;

////////////////////////////////////////  Enter the desired groups - in order of appearance, if listing by group
$groups_list = array(1312,);
////////////////////////////////////////

$list_by_group true;         // 'true' for separate sections by group; 'false' for consolidated list
$include_nonprimary_groups true;   // 'true' to check for group membership in additional groups; 'false' for primary only
$include_post_groups false;      // 'true' to include post-count based group in membership search
$include_moderators false;      // 'true' to include board moderators on page
$repeats_allowed false;      // 'true' to allow multiple appearances by member on page (for $list_by_group = true only)

$sort_by 'name';          // choices - 'id' ascending(default), 'posts' descending, 'name' ascending

$extra_type 'none';         // choices - 'none'(default), 'board' links, 'page' (article) links
///////////////////
// Format - $extra_links['<member userid #>'] = '<forum board #>';
//       or $extra_links['<member userid #>'] = '<TP article #>';
$extra_links = array();
$extra_links['3'] = '5';
$extra_links['2'] = '11';

$extra_label_prefix 'Page of ';   // text to precede member's name in link label for extra link
$extra_label_suffix '';      // text to append to member's name in link label for extra link

$page_title 'Hall of Fame';
$page_subtitle 'Članovi grupe na koje smo posebno ponosni';

$moderator_group 3;
///////////////////////////////////////////////////////////////////////////////////////

$sort_ord 'mem.ID_MEMBER ASC';
if (
$sort_by == 'posts'$sort_ord 'mem.posts DESC';
if (
$sort_by == 'name'$sort_ord 'mem.realName ASC';

if ((
$extra_type != 'board') && ($extra_type != 'page')) $extra_type 'none';

if (
$include_moderators)
   {if (!
in_array($moderator_group$groups_list)) $groups_list[] = $moderator_group;}

$groups_to_use = array();
if (
$list_by_group)
   {
$groups_to_use $groups_list;}
else
   {
$groups_to_use[] = 0;}

$users_already_listed = array();
$users_already_listed[] = 0;

loadLanguage('Profile');

echo 
'<table align="center" width="96%" cellpadding="3" cellspacing="2"><tr>
   <td colspan="4"><h2 align="center">'
$page_title'</h2>
   <span class="smalltext"><h3 align="center">'
$page_subtitle'</h3></span>
</td></tr>'
;

if (!
$list_by_group)
   echo 
'<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
      <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2> </h2>
      </td></tr>'
;

foreach(
$groups_to_use as $groupnumber)
{
   
$loaded_ids = array();
   
$user_profile=array();
   
$memberContext=array();
   
$profile=array();
   
$context['TPortal']['team']=array();
  
   
// get the name of the group
   
$request db_query("
      SELECT groupName FROM 
{$db_prefix}membergroups WHERE ID_GROUP=$groupnumber"__FILE____LINE__);
   if(
mysql_num_rows($request)>0){
      
$row mysql_fetch_row($request);
      
$groupNameX=$row[0];
      
mysql_free_result($request);
   }

   if (
$list_by_group) {
      
$select_where 'mem.ID_GROUP = '.$groupnumber;
      if (
$include_nonprimary_groups$select_where .= ' OR FIND_IN_SET('.$groupnumber.', mem.additionalGroups)';
      if (
$include_post_groups$select_where .= ' OR mem.ID_POST_GROUP = '.$groupnumber;
      if (
$include_moderators && ($groupnumber == $moderator_group)) $select_where 'mem.ID_MEMBER = m.ID_MEMBER';
   }
   else {
      
$select_where 'mem.ID_GROUP IN (' implode(', '$groups_list) . ')';
      if (
$include_nonprimary_groups$select_where .= ' OR FIND_IN_SET(' implode(', mem.additionalGroups) OR FIND_IN_SET('$groups_list) . ', mem.additionalGroups)';
      if (
$include_post_groups$select_where .= ' OR mem.ID_POST_GROUP IN (' implode(', '$groups_list) . ')';
      if (
$include_moderators$select_where .= 'OR mem.ID_MEMBER = m.ID_MEMBER';
   }

   
$select_where '(' $select_where ') AND mem.ID_MEMBER NOT IN (' implode(', '$users_already_listed) . ')';

   
// Load the member's data.
   
$request db_query("
      SELECT   IFNULL(lo.logTime, 0) AS isOnline, IFNULL(a.ID_ATTACH, 0) AS ID_ATTACH, a.filename, a.attachmentType,
         mem.personalText, mem.avatar, mem.additionalGroups, mem.ID_MEMBER as memnum, mem.memberName, mem.ID_GROUP,
         mem.usertitle, mem.karmaBad, mem.karmaGood, mem.realName, mem.lastLogin, mem.websiteTitle,
         mem.websiteUrl, mem.location, mem.posts, them.value AS CP4, m.ID_MEMBER as modmem, g.groupName
      FROM (
{$db_prefix}members AS mem)
         LEFT JOIN 
{$db_prefix}moderators AS m ON (m.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}membergroups AS g ON (g.ID_GROUP = mem.ID_GROUP)
         LEFT JOIN 
{$db_prefix}log_online AS lo ON (lo.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}attachments AS a ON (a.ID_MEMBER = mem.ID_MEMBER)
         LEFT JOIN 
{$db_prefix}themes AS them ON (mem.ID_MEMBER = them.ID_MEMBER AND them.variable = 'CP4' AND them.ID_THEME=1)
      WHERE 
$select_where
      GROUP BY mem.ID_MEMBER
      ORDER BY 
$sort_ord"__FILE____LINE__);
   
$new_loaded_ids = array();
   
$member_count 0;

   while (
$row mysql_fetch_assoc($request))
   {
      if (!
$repeats_allowed$users_already_listed[$row['memnum']] = $row['memnum'];

      
$member_count += 1;

      
$avatar_width '';
      
$avatar_height '';
      if(
$context['browser']['is_ie6']) $avatar_width 'width="' $modSettings['avatar_max_width_external'] . '"';

      
$context['TPortal']['team'][] = array(
         
'username' => $row['memberName'],
         
'usertitle' => $row['usertitle'],
         
'name' => $row['realName'],
         
'groupname' => ($groupnumber == 0) ? $row['groupName'] : $groupNameX ,
         
'posts' => $row['posts'],
         
'karmabad' => $row['karmaBad'],
         
'karmagood' => $row['karmaGood'],
         
'location' => $row['location'],
         
'href' => $scripturl '?action=profile;u=' $row['memnum'],
         
'link' => '<a href="' $scripturl '?action=profile;u=' $row['memnum'] . '" title="' $txt[92] . ' ' $row['realName'] . '">' $row['realName'] . '</a>',
         
'blurb' => $row['personalText'],
         
'avatar' => array(
            
'name' => $row['avatar'],
            
'image' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > '<img  src="' . (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['ID_ATTACH'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />' '') : (stristr($row['avatar'], 'http://') ? '<img src="' $row['avatar'] . '"' $avatar_width $avatar_height ' alt="" style="max-height:280px;max-width:180px;" border="0" />' '<img src="' $modSettings['avatar_url'] . '/' htmlspecialchars($row['avatar']) . '" alt="" style="max-height:280px;max-width:180px;" border="0" />'),
            
'href' => $row['avatar'] == '' ? ($row['ID_ATTACH'] > ? (empty($row['attachmentType']) ? $scripturl '?action=dlattach;attach=' $row['ID_ATTACH'] . ';type=avatar' $modSettings['custom_avatar_url'] . '/' $row['filename']) : '') : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar']),
            
'url' => $row['avatar'] == '' '' : (stristr($row['avatar'], 'http://') ? $row['avatar'] : $modSettings['avatar_url'] . '/' $row['avatar'])
         ),
         
'last_login' => empty($row['lastLogin']) ? $txt['never'] : timeformat($row['lastLogin']),
         
'last_login_timestamp' => empty($row['lastLogin']) ? forum_time(0$row['lastLogin']),
         
'website' => array(
            
'title' => $row['websiteTitle'],
            
'url' => $row['websiteUrl']
         ),
         
'online' => array(
            
'is_online' => $row['isOnline'],
            
'text' => &$txt[$row['isOnline'] ? 'online2' 'online3'],
            
'image_href' => $settings['images_url'] . '/' . ($row['isOnline'] ? 'useron' 'useroff') . '.gif',
         ),
         
'CP4' => $row['CP4'],
         
'member_page' => ($extra_type == 'none') ? '' : empty($extra_links[$row['memnum']]) ? '' $extra_links[$row['memnum']],
      );

   }
   
mysql_free_result($request);

   if (
$member_count 0)
   {
      if (
$list_by_group)
      echo 
'<tr><td colspan="4">
</td></tr><tr width="95%" style="margin-top: 4px;">
         <td class="windowbg3" colspan="4" style="border-top: 2px solid #d0d0d0; padding-top: 4px; "><h2 align="center">' 
$groupNameX '</h2>
         </td></tr>'
;

      echo 
'<tr>';
           
$newrow=0;

      foreach(
$context['TPortal']['team'] as $team)
           {
         echo 
'
            <td valign="top" width="18%">'
.$team['avatar']['image'].'</td>';

         echo 
'   <td valign="top" class="middletext" style="padding: 2px;">';

            echo 
'<h2 style="margin-top: 0; margin-bottom: 4px;">'.$team['link'].'</h2>';

//            echo ''. $team['usertitle'].'
//';

//            if (!$list_by_group)
//               echo ''.$txt[87].': '.$team['groupname'].'
//';

            
if ($modSettings['karmaMode'] == '1')
               echo 
''$modSettings['karmaLabel'], ' '$team['karmagood'] - $team['karmabad'], '
'
;
            elseif (
$modSettings['karmaMode'] == '2')
               echo 
''$modSettings['karmaLabel'], ' +'$team['karmagood'], ' | -'$team['karmabad'], '
'
;

//            echo ''.$txt['lastLoggedIn'].': '.$team['last_login'].'
//';



//            echo !empty($team['location']) ? ''.$txt[227].': '.$team['location'].'
//' : '';

//          echo !empty($team['website']['title']) ? ''.$txt[96].': <a href="'.$team['website']['url'].'" target="_blank">'.$team['website']['title'].'</a>
//' : '';


//            echo !empty($team['blurb']) ? '- '.$team['blurb'].'
//' : '';

            
echo !empty($team['CP4']) ? $team['CP4'].'
'';

            if ((
$extra_type == 'board') && !empty($team['member_page']))
               echo 
'<a href="' $scripturl '?board=' $team['member_page'] . '">'$extra_label_prefix $team['name'] . $extra_label_suffix '</a>
'
;
            if ((
$extra_type == 'page') && !empty($team['member_page']))
               echo 
'<a href="' $scripturl '?page=' $team['member_page'] . '">'$extra_label_prefix $team['name'] . $extra_label_suffix '</a>
'
;

         echo 
'
            </td>'
;

         
$newrow++;
         if(
$newrow>1){
            
$newrow=0;
            echo 
'</tr><tr><td colspan="4"></td></tr><tr>';
         }
           }
      if(
$newrow=1) echo '<td colspan="2"></td>';
      echo 
'</tr>';
   }

}
echo 
'</table>';
?>


Also I make changes in index.template:

if (in_array($context['current_action'], array('gallery', 'admin', 'calendar', 'profile', 'mlist', 'register', 'login', 'help', 'pm', 'invite', 'forum', 'tpadmin', 'halloffame')))


//Hall of fame menu button
if ($context[$current_action == 'halloffame'])
$current_action = 'halloffame';
echo ($current_action=='halloffame' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'halloffame' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=halloffame">Hall of Fame</a>
</td>' , $current_action == 'halloffame' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';

but how to make that correct file is called when I click on link ?

Did you add the:


'halloffame' => array('halloffame.php', 'hallofffame'),


to your http://sitename.com/forum/index.php file?

http://www.simplemachines.org/community/index.php?topic=23864.msg189057#msg189057

58tbird

#424
I'm using 1.1.4 with the default core theme.  I used your instructions only I replaced the word "chat" with the word "news".  The tab showed up just fine, but when I clicked on it I got a message saying something about how I could not edit the page (I was logged in as a moderator at the time).

I am trying to add a tab to access a page I created using the Custom Action Mod.  I successfully created the page, but the only way to access it is to click the "Go to Page" link on the Custom Action Settings.

Here's the link to see the page I made with the Custom Action Mod: here

How can I make the "News" tab link to this page so it can be easily accessed by members and visitors?

IchBin™

I don't see the link on your site. If you post the code we can take a look and see if there's something you need to change.
IchBin™        TinyPortal

58tbird

Thank you IchBin!  I appreciate your help on this.

Sorry, but since it didn't work, I removed it.  But here's the code I used to insert the News tab:

After:
// Show the [home] button.
echo ($current_action=='home' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'home' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '">' , $txt[103] , '</a>
</td>' , $current_action == 'home' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


I inserted this:
// Show the [news] button.
echo ($current_action=='news' || $context['browser']['is_ie4']) ? '<td class="maintab_active_' . $first . '">&nbsp;</td>' : '' , '
<td valign="top" class="maintab_' , $current_action == 'news' ? 'active_back' : 'back' , '">
<a href="', $scripturl, '?action=news">News</a>
</td>' , $current_action == 'news' ? '<td class="maintab_active_' . $last . '">&nbsp;</td>' : '';


Is this what you're asking me about?  I think there must be something I'm missing, because I don't understand how this code to insert a tab will call-up the News page.

Also, do you think what I'm trying to accomplish is better achieved this way or by using the RSS Feed Poster Mod?

IchBin™

That code looks like it should work to me. When you use the code what does it do?
IchBin™        TinyPortal

58tbird

#428
Sorry IchBin - I've been at work all day.  Thank you for your reply.

I re-inserted the code and tried it again logged-in as an administrator this time, and when I clicked on the News tab it opened up Admin>Main>News and Newsletters>News for my News Fader.

Is there a way to get it to open the News action I made with the Custom Action Mod: here?  Also, do you think I should use the RSS Feed Poster Mod instead (I haven't tried it yet)?

IchBin™

I don't think so, since there is already a news action defined. As you noticed it takes you to it. :) IF I were you I would just rename it to something else that you can live with. action=recentnews or something.
IchBin™        TinyPortal

58tbird

#430
I changed it to "In The News" and now when I click the tab, it just returns me to my home page.

I'm very new at this, but it seems to me like there's something I need to do to connect the "In The News" tab to the custom action I created which has it's own URL (http://www.myforumname.com/index.php?action=News).  Is my thinking correct, or am I completely lost (which would be my first guess)?

Also, I'm wondering if I can add a small search window on the page where members and guests can enter a their own terms and have custom Google Alert results displayed for their terms.  Being fairly new at all this, I have no idea how to go about it.  Is this something I should post to the SMF 1.x Support board?

IchBin™

If you change both the button code to newstwo and your custom action to newstwo does it work? Your second question is really off topic so I would prefer that we continue on topic and you start another topic. Thanks.
IchBin™        TinyPortal

58tbird

#432
Sorry about that - I'll stick to one topic.  I was getting ahead of myself.

Well, I tried renaming all 6 instances of "In The News" to "newstwo" in the code and clicking the tab created still returned me to the main page. 

I was trying variations and accidentally clicked "delete" instead of "edit" in the File Manager.  I didn't panic, because I can see my index file in the trash can.  I clicked on it to restore it, but it's not showing up in the right side of my File Manager, there's no file URL, and I can't access my forum.  I posted to the SMF 1.x Support board for help on this.

58tbird

...Okay -- well, that was an adventure! :P

Alright, I got my index.template.php restored.  Now, I'm ready to resume working on this issue if IchBin or anyone else can figure this one out for me.

I would like to make it so that my new tab will open the page I created using the Custom Action Mod for all members and guests.  I'm going to bed now, but I'll be working on this tomorrow.  Thank you all for any assistance you can provide.

IchBin™

You mentioned that you changed the code to newstwo. Did you also change your custom action page to have the same action?
IchBin™        TinyPortal

58tbird

Duh...hadn't thought of that  :-[

However, I did since reading your reply.  I made all the words match between code on the index.template.php file, the entries on the Custom Actions Settings, and the code given to me by Google which I pasted into the Custom Action Settings.  But I'm still taken to the Home page when I click the new tab.

I found a Website Button Mod which adds a tab and provides for connecting to a url and installed it.  When I click the tab it created, it takes me to the page I want.  Maybe I should just stick with that solution.

I really appreciate all your help on this IchBin.  I'm sure it's my lack of knowledge and experience that's preventing me from being able to add a tab I can use.

unrelenting

Send me your php files and I'll give them a look over. Or just post the contents here.

Needed files are:

forum/index.php
forum/Themes/index.template.php
forum/Sources/newtwo.php (or whatever you named it)

If you added any sensitive information (like usernames or passwords in the files) then remove it before you post it.

58tbird

#437
Hey unrelenting - thank you for your offer to look over my files.  I've never done this before, so I hope I'm doing this right.  I saved the codes in Notepad and have attached them.

As I noted in my previous post, I've reverted to using the Website Tab Mod to gain access to the Google feed I made.  But I think adding tabs would work better.  The Website Tab (I've renamed News Alerts) doesn't enlarge or lighten - the Home tab stays enlarged and light blue.  Plus, it only adds one tab and I can't add any more if I need more in the future.  Otherwise, it seems to work fine.

Let me know if there's anything else you need to see.  Any advice or suggestions are welcome since I'm very new at this and don't have any idea what I'm doing and I'm sure I must be doing some things contrary to convention.

unrelenting

Quote from: 58tbird on March 30, 2008, 03:04:44 AM
Hey unrelenting - thank you for your offer to look over my files.  I've never done this before, so I hope I'm doing this right.  I saved the codes in Notepad and have attached them.

As I noted in my previous post, I've reverted to using the Website Tab Mod to gain access to the Google feed I made.  But I think adding tabs would work better.  The Website Tab (I've renamed News Alerts) doesn't enlarge or lighten - the Home tab stays enlarged ad lightened.  Plus, it only adds one tab and I can't add any more if I need more in the future.  Otherwise, it seems to work fine.

Let me know if there's anything else you need to see.  Any advice or suggestions are welcome since I'm very new at this and don't have any idea what I'm doing and I'm sure I must be doing some things contrary to convention.

I didn't realize your were using a custom action "mod". I thought you wrote your own. I don't know enough about that mod to be able to spot the problem.

My suggestion would be to try this tutorial and do your own modification using this method. It is simple and straight forward and if you run into problems with it I can help you without a doubt.

http://www.simplemachines.org/community/index.php?topic=23864.0

58tbird

#439
Sorry if I wasn't clear on that unrelenting. :(

I appreciate your willingness to help, and the good references you provided me.  As of this moment, the Custom Action Mod seems to be doing the trick (with a couple of issues I'm working on), so I may come back and try manually modifying using these resources later next week.  Thank you very much  ;)

Advertisement: