Community Button Drop-down Menu

Started by MiY4Gi, 7 years ago

previous topic - next topic

0 Members and 1 Guest are viewing this topic.

MiY4Gi

*
7 years ago
I want to add a drop-down menu to the Community button, and place links to a few of my forum boards.

Firstly, where's the code for the Community button?

And can someone show me what code to use?
Check out my new anime club. Discuss and share anime, or just fool around with other forumites. Join us at MyAnimeClub.

Feline

*
#1
7 years ago
You find the home button definition in the file PortaMxIntegrate.php.
What you have to add? I don't know .. look at the Subs.php as example.
Many are stubborn in relation to the way, but less in relation to the target.

TedTeddy

*
#2
7 years ago
I love your PortaMX. Before I used SimplePortal, but PortaMX is really awesome! But... I've got a problem:

I want to add a sub-button "Login" to the community-button. It works fine, but the new sub-button is still visible, even if the user is already logged in.

I have added the "login-things" like "Login, Logout, Register" to the community-button as sub-buttons as following: (I didn't change the code, just copy & paste)

Code Select
array(
'community' => array(
'title' => $txt['forum'],
'href' => $scripturl . '?action=community',
'active_button' => false,
'sub_buttons' => array(

'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
),

),
),
),


I think the line "'show' => $user_info['is_guest']" isn't working. Can anybody tell me, why and how to solve this problem? I just copied and pasted that code-block out of "subs.php" from the SMF-original-file.

Feline

*
#3
7 years ago
Well .. that don't work, because the hook is called after the drop buttons they not visible.
Do follow in PortaMxIntegrate.php:
find:
Code Select

// add community button after 'home'
$fnd = array_search('home', array_keys($menudata)) + 1;

add before:
Code Select

//subbuttons for the comunity button
global $user_info;

if($user_info['is_guest'])
$subbuttons = array(
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
)
);

else
$subbuttons = array(
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;'. $context['session_var'] .'='. $context['session_id'],
)
);


find:
Code Select

array(
'community' => array(
'title' => $txt['forum'],
'href' => $scripturl . '?action=community',
'active_button' => false,
'sub_buttons' => array(
),
),
),

replace with:
Code Select

array(
'community' => array(
'title' => $txt['forum'],
'href' => $scripturl . '?action=community',
'active_button' => false,
'sub_buttons' => $subbuttons,
),
),


That worked ...
Many are stubborn in relation to the way, but less in relation to the target.

TedTeddy

*
#4
7 years ago
Thank you very much feline! Works like a charme. :)

Just one more little problem:
What do I have to do, if I want to insert a button for both, guests and also members? I tried the "array_push"-PHP-method, but I'm not a PHP-programmer. I don't understand the whole syntax of that method. Or should I do something else?
Of course, I could copy and paste the code to the true and also to the false-block, but I think there is a better way, isn't it?

Feline

*
#5
7 years ago
For this you can try:
Code Select

//subbuttons for the comunity button
global $user_info;

if($user_info['is_guest'])
$subbuttons = array(
'login' => array(
'title' => $txt['login'],
'href' => $scripturl . '?action=login',
),
'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
)
);

else
$subbuttons = array(
'logout' => array(
'title' => $txt['logout'],
'href' => $scripturl . '?action=logout;'. $context['session_var'] .'='. $context['session_id'],
)
);

$subbuttons = arry_merge(
$subbuttons,
array(
'mybutton' => array(
'title' => 'any text',
'href' => $scripturl . '?action=xyz',
),
)
);

This add a button after ..
Many are stubborn in relation to the way, but less in relation to the target.

TedTeddy

*
#6
7 years ago
Fantastic! :) You're really great Feline! :)

Svaha

*
#7
7 years ago
I use this code (original by JPDemi) in an article to get a nice list of recent posted to topics :


Code Select
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info, $modSettings, $user_profile, $smcFunc;

//////////////////////////////////////////// ---------- Unconditional Exclude
//  
  $exclude_boards = array();   // KEEP (to preserve variable declaration)
//   $exclude_boards = array(5);   //  Exclude single board
//     $exclude_boards = array(55,69);   //  Exclude multiple boards
  $ex_board_clause = !empty($exclude_boards) ? ' AND b.id_board NOT IN (' . implode(', ', $exclude_boards) . ')' : '';
//  
//  

//////////////////////////////////////////// ---------- Use in TP PHP Article (no title or frame from theme)
//   This will give most recent XX posted to topics -OR-
//   most recent XX unreplied to topics -OR-
//   topics posted to in last XX hours -OR-
//   most recent XX topics on topic notify list
//  
//   Sorts by most recent reply (descending; most recent first) -OR-
//    creation order (descending; most recent first)
//  
//   All in the detailed topic format
//  
//  
//   Default
//   index.php?page=##
//   most recent posted to topics - will list
//   number equal to  $settings['number_recent_posts']
//  
//   index.php?page=##;count=50 or index.php?page=##;type=last;count=50
//   50 most recently posted to topics
//  
//   index.php?page=##;type=unreplied or index.php?page=##;type=unreplied;count=50
//   Most recent unreplied to topics - will
//   list number specified in 'count' or default to
//   number equal to  $settings['number_recent_posts']
//  
//   index.php?page=##;type=hours or index.php?page=##;type=hours;count=12
//   Topics posted to in last number of hours
//   specified in 'count' or default to 24.
//  
//   index.php?page=##;type=notify or index.php?page=##;type=notify;count=50
//   Topics in topic notifcation list up to number
//   specified in 'count' or a maximum of 100 topics.
//  
//   *** Admins Only ***
//   index.php?page=##;type=notify;user=XXX or index.php?page=##;type=notify;user=XXX;count=50
//   Topics in topic notifcation list of specified user up to number
//   specified in 'count' or a maximum of 100 topics.
//  
//   index.php?page=##;type=started or index.php?page=##;type=started;count=50
//   Topics started by current user list up to number
//   specified in 'count' or a maximum of 100 topics.
//  
//   *** Admins Only ***
//   index.php?page=##;type=notify;user=XXX or index.php?page=##;type=started;user=XXX;count=50
//   Topics started by specified user up to number
//   specified in 'count' or a maximum of 100 topics.
//  
//   Add argument order=create to sort by topic creation sequence (most recent first)
//   rather than by last reply sequence

  $do_query = 1;

//////////////////////////////////////////// ---------- Poor Man's Global Announcements Block (center block - no Title/Frame)
//   Delete documentation comments above and marked section below
//
//   $announce_topics = array(254, 568, 675, 678); // Topic ID's to be 'Announced'
//
//   $heading = '<center>Announcements<center>';
//   $where_clause = 't.ID_TOPIC IN (' . implode(', ', $announce_topics) . ')';
//   $limit_clause = '';
//   $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////  

//////////////////////////////////////////// ---------- Last 5 Topics Started by User Block (center block - no Title/Frame)
//   Delete documentation comments above and marked section below
//
//   $heading = 'Most Recent Topics You Started';
//   $where_clause = 'ms.ID_MEMBER = '.$ID_MEMBER;
//   $limit_clause = 'LIMIT 5';
//   $order_clause = 't.ID_FIRST_MSG DESC';
////////////////////////////////////////////  

//////////////////////////////////////////// ---------- Boardindex Most Recent Topics Arguments
//
//   Comment out the Info Center's Most Recent Posts Code and Insert this
//   to show Most Recent Topics in full detail style instead
//
//   $list_count = $settings['number_recent_posts'];
//   $heading = 'Most Recently Posted To Topics';
//   $where_clause = 't.ID_LAST_MSG >= ' . ($modSettings['maxMsgID'] - 50 * min($list_count, 5));
//   $limit_clause = 'LIMIT ' . $list_count;
//   $order_clause = 't.ID_LAST_MSG DESC';
////////////////////////////////////////////  

////////////////////////////////////////////  ------ Remove down to next mark to use in block/boardindex ------
//
  if (empty($settings['number_recent_posts']))
     $number_recent_posts = 20;
  else
     $number_recent_posts = $settings['number_recent_posts'];

if( isset($_GET['type']) )
     $list_type = $_GET['type'];
  else
     $list_type = 'last';

if( isset($_GET['count']) )
     $list_count = $_GET['count'];
  else
  {
     $list_count = $number_recent_posts;
     if ($list_type == 'notify')
$list_count = 100;
     elseif ($list_type == 'hours')
$list_count = 24;
  }

  if ($list_count <= 0)
  {
     $list_count = $number_recent_posts;
     if ($list_type == 'hours')
$list_count = 24;
  }

  if ($list_count > 100)
     $list_count = 168;

if( isset($_GET['order']) )
     $list_order = $_GET['order'];
  else
     $list_order = 'lastpost';

if( $list_order == 'create' )
     $order_clause = 't.id_first_msg DESC';
  else
     $order_clause = 't.id_last_msg DESC';

  if ($list_type == 'hours')
  {
     $list_from = strtotime($list_count.' hours ago');
     $where_clause = 'ml.poster_time >= ' . $list_from;
     $limit_clause = ' ';
     $heading = 'Topics Posted To In Last '. $list_count . ' Hours';
  }
  elseif ($list_type == 'unreplied')
  {
     $where_clause = 't.num_replies = 0';
     if ($list_count == 0)
     {
$limit_clause = ' ';
$heading = 'Unreplied To Topics';
     }
     else
     {
     $limit_clause = 'LIMIT ' . $list_count;
     $heading = $list_count . ' Most Recent Unreplied To Topics';
     }
  }
  elseif ($list_type == 'notify')
  {
     if (isset($_GET['user']) && $user_info['is_admin'])
     {
$watched_topics = array();
$request = $smcFunc['db_query']("", "SELECT id_topic FROM ".$db_prefix."log_notify
WHERE id_member = {int:user_id}
AND id_board = 0",
array('user_id' => $_GET['user']));
while ($row = $smcFunc['db_fetch_assoc']($request))
   $watched_topics[] = $row['id_topic'];
$smcFunc['db_free_result']($request);
$heading = $list_count . ' Most Recent Topics Being Watched by User # '.$_GET['user'];
$where_clause = 't.id_topic IN (' . implode(', ', $watched_topics) . ')';
$limit_clause = 'LIMIT ' . $list_count;
if (empty($watched_topics))
   $do_query = 0;
     }
     else
     {
$watched_topics = array();
$request = $smcFunc['db_query']("", "SELECT id_topic FROM ".$db_prefix."log_notify
WHERE id_member = {int:id_member}
AND id_board = 0",
array('id_member' => $user_info['id']));
while ($row = $smcFunc['db_fetch_assoc']($request))
   $watched_topics[] = $row['id_topic'];
$smcFunc['db_free_result']($request);
$heading = $list_count . ' Most Recent Topics Being Watched';
$where_clause = 't.id_topic IN (' . implode(', ', $watched_topics) . ')';
$limit_clause = 'LIMIT ' . $list_count;
if (empty($watched_topics))
   $do_query = 0;
     }
  }
  elseif ($list_type == 'started')
  {
     if (isset($_GET['user']) && $user_info['is_admin'])
     {
$where_clause = 'ms.id_member = '.$_GET['user'];
$limit_clause = 'LIMIT ' . $list_count;
     if( $list_order == 'create' )
{
   $order_clause = 't.id_first_msg DESC';
   $heading = 'Most Recent Topics Started by User '.$_GET['user'];
}
else
{
   $order_clause = 't.id_last_msg DESC';
   $heading = 'Most Recently Posted To Topics Started by User '.$_GET['user'];
}
     }
     else
     {
$where_clause = 'ms.id_member = '.$user_info['id'];
$limit_clause = 'LIMIT ' . $list_count;
     if( $list_order == 'create' )
{
   $order_clause = 't.id_first_msg DESC';
   $heading = 'Most Recent Topics You Started';
}
else
{
   $order_clause = 't.id_last_msg DESC';
   $heading = 'Most Recently Posted To Topics You Started';
}
     }
  }
  else
  {
     $where_clause = 't.id_last_msg >= ' . ($modSettings['maxMsgID'] - 90 * min($list_count, 5));
     $limit_clause = 'LIMIT ' . $list_count;
     $heading = $list_count . ' Most Recently Posted To Topics';
  }
//
////////////////////////////////////////////  ------ Remove up to first mark to use in block/boardindex ------

  $stable_icons = array('xx', 'thumbup', 'thumbdown', 'exclamation', 'question', 'lamp', 'smiley', 'angry', 'cheesy', 'grin', 'sad', 'wink', 'moved', 'recycled', 'wireless');
  $icon_sources = array();
  foreach ($stable_icons as $icon)
     $icon_sources[$icon] = 'images_url';

  $groupcolors = array();
  $request = $smcFunc['db_query']("", "SELECT id_group, online_color FROM ".$db_prefix."membergroups",array());
  while ($row = $smcFunc['db_fetch_assoc']($request))
     $groupcolors[$row['id_group']] = $row['online_color'];
  $smcFunc['db_free_result']($request);

  $topics = array();

  if ($do_query == 1)
  {
     $request = $smcFunc['db_query']("", "
     SELECT
   ms.subject AS firstSubject, ms.poster_time AS firstPosterTime, ms.id_topic, t.id_last_msg, t.id_board, b.name AS bname,
   t.num_replies, t.num_views, ms.id_member AS ID_FIRST_MEMBER, ml.id_member AS ID_LAST_MEMBER,
   ml.poster_time AS lastPosterTime, IFNULL(mems.real_name, ms.poster_name) AS firstPosterName,
   IFNULL(meml.real_name, ml.poster_name) AS lastPosterName,
   mems.id_group as mems_group, meml.id_group as meml_group,
   ml.subject AS lastSubject, b.member_groups,
   ml.icon AS lastIcon, ms.icon AS firstIcon, t.id_poll, t.is_sticky, t.locked, ml.modified_time AS lastModifiedTime,
   LEFT(ml.body, 384) AS lastBody, LEFT(ms.body, 384) AS firstBody,
   ml.smileys_enabled AS lastSmileys, ms.smileys_enabled AS firstSmileys, t.id_first_msg,"
   . ($user_info['is_guest'] ? '1 AS isRead, 0 AS new_from' : '
   IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= ml.id_msg_modified AS isRead,
   IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . "
FROM (".$db_prefix."messages AS ms, ".$db_prefix."messages AS ml, ".$db_prefix."topics AS t, ".$db_prefix."boards AS b)
   LEFT JOIN ".$db_prefix."members AS mems ON (mems.id_member = ms.id_member)
   LEFT JOIN ".$db_prefix."members AS meml ON (meml.id_member = ml.id_member)
   LEFT JOIN ".$db_prefix."log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = ".$user_info['id'].")
   LEFT JOIN ".$db_prefix."log_mark_read AS lmr ON (lmr.id_board = t.id_board AND lmr.id_member = ".$user_info['id'].")
WHERE " . $where_clause . $ex_board_clause . "
   AND t.id_topic = ms.id_topic
   AND b.id_board = t.id_board" . (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ? " AND b.id_board != ".$modSettings['recycle_board'] : "") . "
   AND ms.id_msg = t.id_first_msg
   AND ml.id_msg = t.id_last_msg
   AND " . $user_info['query_see_board'] . "
ORDER BY " . $order_clause . " " . $limit_clause,
      array());


  $topic_ids = array();
  while ($row = $smcFunc['db_fetch_assoc']($request))
  {
     if ($row['id_poll'] > 0 && $modSettings['pollMode'] == '0')
continue;

     $topic_ids[] = $row['id_topic'];

     // Clip the strings first because censoring is slow :/. (for some reason?)
     $row['firstBody'] = strip_tags(strtr(parse_bbc($row['firstBody'], $row['firstSmileys'], $row['id_first_msg']), array('<br />' => '
')));
     if (strlen($row['firstBody']) > 128)
$row['firstBody'] = substr($row['firstBody'], 0, 128) . '...';
     $row['lastBody'] = strip_tags(strtr(parse_bbc($row['lastBody'], $row['lastSmileys'], $row['id_last_msg']), array('<br />' => '
')));
     if (strlen($row['lastBody']) > 128)
$row['lastBody'] = substr($row['lastBody'], 0, 128) . '...';

$row['lastSubject'] = $row['firstSubject'];
$row['lastBody'] = $row['firstBody'];

     // Decide how many pages the topic should have.
     $topic_length = $row['num_replies'] + 1;
     if ($topic_length > $modSettings['defaultMaxMessages'])
     {
$tmppages = array();
$tmpa = 1;
for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
{
   $tmppages[] = '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.' . $tmpb . ';topicseen">' . $tmpa . '</a>';
   $tmpa++;
}
// Show links to all the pages?
if (count($tmppages) <= 5)
   $pages = '« ' . implode(' ', $tmppages);
// Or skip a few?
else
   $pages = '« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];

if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
   $pages .= '  <a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;all">' . $txt['all'] . '</a>';
$pages .= ' »';
     }
     else
$pages = '';

     // We need to check the topic icons exist... you can never be too sure!
     if (empty($modSettings['messageIconChecks_disable']))
     {
// First icon first... as you'd expect.
if (!isset($icon_sources[$row['firstIcon']]))
   $icon_sources[$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';
// Last icon... last... duh.
if (!isset($icon_sources[$row['lastIcon']]))
   $icon_sources[$row['lastIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['lastIcon'] . '.gif') ? 'images_url' : 'default_images_url';
     }

     $color_start = !empty($groupcolors[$row['mems_group']]) ? $groupcolors[$row['mems_group']] : '';
     $color_last = !empty($groupcolors[$row['meml_group']]) ? $groupcolors[$row['meml_group']] : '';

     // And build the array.
     $topics[$row['id_topic']] = array(
'id' => $row['id_topic'],
'first_post' => array(
   'id' => $row['id_first_msg'],
   'member' => array(
      'name' => $row['firstPosterName'],
      'id' => $row['ID_FIRST_MEMBER'],
      'href' => $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'],
      'link' => !empty($row['ID_FIRST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_FIRST_MEMBER'] . '" title="' . $txt['profile_of'] . ' ' . $row['firstPosterName'] . '">' . '<font color="' . $color_start . '">' . $row['firstPosterName'] . '</font>' . '</a>' : $row['firstPosterName']
   ),
   'time' => timeformat($row['firstPosterTime']),
   'timestamp' => forum_time(true, $row['firstPosterTime']),
   'subject' => $row['firstSubject'],
   'preview' => $row['firstBody'],
   'icon' => $row['firstIcon'],
   'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
   'href' => $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen',
   'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.0;topicseen">' . $row['firstSubject'] . '</a>'
),
'last_post' => array(
   'id' => $row['id_last_msg'],
   'member' => array(
      'name' => $row['lastPosterName'],
      'id' => $row['ID_LAST_MEMBER'],
      'href' => $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'],
      'link' => !empty($row['ID_LAST_MEMBER']) ? '<a href="' . $scripturl . '?action=profile;u=' . $row['ID_LAST_MEMBER'] . '">' . '<font color="' . $color_last . '">' . $row['lastPosterName'] . '</font>' . '</a>' : $row['lastPosterName']
   ),
   'time' => timeformat($row['lastPosterTime']),
   'timestamp' => forum_time(true, $row['lastPosterTime']),
   'subject' => $row['lastSubject'],
   'preview' => $row['lastBody'],
   'icon' => $row['lastIcon'],
   'icon_url' => $settings[$icon_sources[$row['lastIcon']]] . '/post/' . $row['lastIcon'] . '.gif',
   'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'],
   'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['id_last_msg']) . ';topicseen#msg' . $row['id_last_msg'] . '">' . $row['lastSubject'] . '</a>'
),
'new' => $row['isRead'],
'new_from' => $row['new_from'],
'new_href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['new_from'] . ';topicseen#new',
'href' => $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen' . ($row['num_replies'] == 0 ? '' : 'new'),
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . ($row['num_replies'] == 0 ? '.0' : '.msg' . $row['new_from']) . ';topicseen#msg' . $row['new_from'] . '">' . $row['firstSubject'] . '</a>',
'is_sticky' => !empty($modSettings['enableStickyTopics']) && !empty($row['isSticky']),
'is_locked' => !empty($row['locked']),
'is_poll' => $modSettings['pollMode'] == '1' && $row['id_poll'] > 0,
'is_hot' => $row['num_replies'] >= $modSettings['hotTopicPosts'],
'is_very_hot' => $row['num_replies'] >= $modSettings['hotTopicVeryPosts'],
'is_posted_in' => false,
'icon' => $row['firstIcon'],
'icon_url' => $settings[$icon_sources[$row['firstIcon']]] . '/post/' . $row['firstIcon'] . '.gif',
'subject' => $row['firstSubject'],
'pages' => $pages,
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'board' => array(
   'id' => $row['id_board'],
   'name' => $row['bname'],
   'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
   'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['bname'] . '</a>'
)
     );

     determineTopicClass($topics[$row['id_topic']]);
  }
  $smcFunc['db_free_result']($request);

  if (!empty($modSettings['enableParticipation']) && !empty($topic_ids))
  {
     $result = $smcFunc['db_query']("", "
SELECT id_topic
FROM ".$db_prefix."messages
WHERE id_topic IN (" . implode(', ', $topic_ids) . ")
   AND id_member = {int:id_member}",
array('id_member' => $user_info['id']));
     while ($row = $smcFunc['db_fetch_assoc']($result))
     {
if (empty($topics[$row['id_topic']]['is_posted_in']))
{
   $topics[$row['id_topic']]['is_posted_in'] = true;
   $topics[$row['id_topic']]['class'] = 'my_' . $topics[$row['id_topic']]['class'];
}
     }
     $smcFunc['db_free_result']($result);
  }

  }

if (!empty($topics))
   {
   echo '
<div class="tborder" ', $context['browser']['needs_size_fix'] && !$context['browser']['is_ie6'] ? 'style="width: 100%;margin:0px;"' : 'style="margin:0px;"', '>
   <table border="0" width="100%" cellspacing="1" cellpadding="1" class="bordercolor">
<tr>';

   echo '
   <td class="titlebg" colspan="7">', $heading, '</td>';
   echo '
</tr>';

   echo '
   <tr class="titlebg">
      <td width="10%" colspan="2"> </td>
      <td>', $txt['subject'], '
      </td><td width="14%">', $txt['posted_by'], '
      </td><td width="4%" align="center">', $txt['replies'], '
      </td><td width="4%" align="center">', $txt['views'], '
      </td><td width="24%">', $txt['last_post'], '
      </td>
   </tr>';

  foreach ($topics as $topic)
  {
     // Do we want to seperate the sticky and lock status out?
     if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
     if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'locked') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

     echo '
   <tr>
      <td class="windowbg2" valign="middle" align="center" width="6%">
 <img src="' . $settings['images_url'] . '/topic/' . $topic['class'] . '.gif" alt="" />
      </td><td class="windowbg2" valign="middle" align="center" width="4%">
 <img src="' . $topic['first_post']['icon_url'] . '" alt="" align="middle" />
      </td><td class="windowbg' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '3' : '' , '" width="48%" valign="middle">' , $topic['is_locked'] && !empty($settings['seperate_sticky_lock']) ? '
 <img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" style="margin: 0;" />' : '' , $topic['is_sticky'] && !empty($settings['seperate_sticky_lock']) ? '
 <img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" style="margin: 0;" />' : '', $topic['first_post']['link'];
      if ($topic['new'] == 0)
 {
 echo '<a href="', $topic['new_href'], '"> <img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt['seconds_with'], '" /></a>';
 }
echo '
      <span class="smalltext">', $topic['pages'], '<br>', $txt['in'], ' ', $topic['board']['link'], '</span></td>
      <td class="windowbg2" valign="middle" width="14%">
 ', $topic['first_post']['member']['link'], '</td>
      <td class="windowbg" valign="middle" width="4%" align="center">
 ', $topic['replies'], '</td>
      <td class="windowbg" valign="middle" width="4%" align="center">
 ', $topic['views'], '</td>
      <td class="windowbg2" valign="middle" width="22%">
 <a href="', $topic['last_post']['href'], '"><img src="', $settings['images_url'], '/icons/last_post.gif" alt="', $txt['last_post'], '" title="', $txt['last_post'], '" style="float: right;" /></a>
 <span class="smalltext">
    ', $topic['last_post']['time'], '<br />
    ', $txt['by'], ' ', $topic['last_post']['member']['link'], '
 </span>
      </td>
   </tr>';
  }

   echo '</table></div>';

   }
  else
      echo '<b><u>'.$heading.'<br><br>No Topics Match Search Criteria</u></b>';



I would like to have two buttons in a drop down menu in community / forum, one for the topics Vandaag (Today / Heute) and one for the topics during the last Week (Week / Woche)

The links look like this :
www.mysite.nl/index.php?spage=Vandaag;type=hours
www.mysite.nl/index.php?spage=Vandaag;type=hours;count=168

Feline

*
#8
7 years ago
you can use the sample above and put in your links and titles ...
Many are stubborn in relation to the way, but less in relation to the target.

Svaha

*
#9
7 years ago
Thanks Feline, I used this for my two buttons :


Code Select
//subbuttons for the comunity button

$subbuttons = array(
'mybutton1' => array(
'title' => 'Vandaag',
'href' => $scripturl . '?spage=Vandaag;type=hours',
),
'mybutton2' => array(
'title' => 'Week',
'href' => $scripturl . '?spage=Vandaag;type=hours;count=168',
)
);


* Shouts

Feline
5 months ago
Today we update our Forum to the Version 1.45
Feline
8 months ago
Today we update our Forum to Version 1.4
This release is full compatible with the EU GDPR
Feline
10 months ago
Update for PortaMx 1.54 ecl released.
With this updates the Portal works with PHP 7.x and SMF 2.0.15
Feline
10 months ago
PortaMx Forum 1.3
released !

*
Feline
a year ago
Today we switched to PHP 7.2 and activate Opcode caching.
Fast .. Very fast *
Feline
a year ago
Today we upgrade our old SMF 2.0 Forum to PortaMx Forum *

* Calendar

Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28