× Didn't find what you were looking for? Ask a question
Top Posters
Since Sunday
g
3
3
2
J
2
p
2
m
2
h
2
s
2
r
2
d
2
l
2
a
2
New Topic  
drfun drfun
wrote...
Posts: 35
Rep: 2 0
10 years ago
First i will like to say thanks to the admin for accepting me into the forum, since i got hold of the forum, i have not been able to look pass it, i must say am in love with it.

Admin sorry this might not be the right place to post this question, please kindly move it if need be. My question is that i will like you to help me with the smf mod & theme powering this great forum, as i have explain in my initial mail to you, Also if you can teach us in here on how to achieve this. i will be very grateful to learn.
Read 10931 times
68 Replies
All Student Forum

Related Topics

Replies
wrote...
Educator
10 years ago
First i will like to say thanks to the admin for accepting me into the forum, since i got hold of the forum, i have not been able to look pass it, i must say am in love with it.

Welcome, and thanks Slight Smile

My question is that i will like you to help me with the smf mod & theme powering this great forum, as i have explain in my initial mail to you, Also if you can teach us in here on how to achieve this. i will be very grateful to learn.

Will try my best, what exactly are you looking to achieve, starting with your first priority?
drfun Author
wrote...
10 years ago
Thanks for the quick response, i wish to run an education forum, and i would love to have the forum to have some of the great features that this forum has such as Latest questions, Ask a question, Unanswered questions, Resolved, and Unresolved / solved.
All Student Forum
wrote...
Educator
10 years ago
Unanswered questions

Let me start with this.

1) You'll need access to SSI.php. Open it, and just before this:

Code:
?>

Add:

Code:
function ssi_unansweredTopics($num_recent = 8, $exclude_boards = null, $include_boards = null, $output_method = 'echo')
{
global $context, $settings, $scripturl, $txt, $db_prefix, $user_info;
global $modSettings, $smcFunc, $memberContext;

if ($exclude_boards === null && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0)
$exclude_boards = array($modSettings['recycle_board']);
else
$exclude_boards = empty($exclude_boards) ? array() : (is_array($exclude_boards) ? $exclude_boards : array($exclude_boards));

// Only some boards?.
if (is_array($include_boards) || (int) $include_boards === $include_boards)
{
$include_boards = is_array($include_boards) ? $include_boards : array($include_boards);
}
elseif ($include_boards != null)
{
$output_method = $include_boards;
$include_boards = array();
}

$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';

// Find all the posts in distinct topics.  Newer ones will have higher IDs.
$request = $smcFunc['db_query']('substring', '
SELECT
m.poster_time, ms.subject, m.id_topic, m.id_member, m.id_msg, b.id_board, b.name AS board_name, t.num_replies, t.num_views,
IFNULL(mem.real_name, m.poster_name) AS poster_name, ' . ($user_info['is_guest'] ? '1 AS is_read, 0 AS new_from' : '
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, 0)) >= m.id_msg_modified AS is_read,
IFNULL(lt.id_msg, IFNULL(lmr.id_msg, -1)) + 1 AS new_from') . ', SUBSTRING(m.body, 1, 384) AS body, m.smileys_enabled, m.icon
FROM {db_prefix}topics AS t
INNER JOIN {db_prefix}messages AS m ON (m.id_msg = t.id_last_msg)
INNER JOIN {db_prefix}boards AS b ON (b.id_board = t.id_board)
INNER JOIN {db_prefix}messages AS ms ON (ms.id_msg = t.id_first_msg)
LEFT JOIN {db_prefix}members AS mem ON (mem.id_member = m.id_member)' . (!$user_info['is_guest'] ? '
LEFT JOIN {db_prefix}log_topics AS lt ON (lt.id_topic = t.id_topic AND lt.id_member = {int:current_member})
LEFT JOIN {db_prefix}log_mark_read AS lmr ON (lmr.id_board = b.id_board AND lmr.id_member = {int:current_member})' : '') . '
WHERE t.id_last_msg >= {int:min_message_id}
AND t.num_Replies = 0
' . (empty($exclude_boards) ? '' : '
AND b.id_board NOT IN ({array_int:exclude_boards})') . '
' . (empty($include_boards) ? '' : '
AND b.id_board IN ({array_int:include_boards})') . '
AND {query_wanna_see_board}' . ($modSettings['postmod_active'] ? '
AND t.approved = {int:is_approved}
AND m.approved = {int:is_approved}' : '') . '
ORDER BY t.id_last_msg DESC
LIMIT ' . $num_recent,
array(
'current_member' => $user_info['id'],
'include_boards' => empty($include_boards) ? '' : $include_boards,
'exclude_boards' => empty($exclude_boards) ? '' : $exclude_boards,
'min_message_id' => $modSettings['maxMsgID'] - 3500 * min($num_recent, 5),
'is_approved' => 1,
)
);
$posts = array();
while ($row = $smcFunc['db_fetch_assoc']($request))
{
$row['body'] = strip_tags(strtr(parse_bbc($row['body'], $row['smileys_enabled'], $row['id_msg']), array('<br />' => '')));
if ($smcFunc['strlen']($row['body']) > 128)
$row['body'] = $smcFunc['substr']($row['body'], 0, 128) . '...';

// Censor the subject.
censorText($row['subject']);
censorText($row['body']);

if (empty($modSettings['messageIconChecks_disable']) && !isset($icon_sources[$row['icon']]))
$icon_sources[$row['icon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['icon'] . '.gif') ? 'images_url' : 'default_images_url';

// Build the array.
$posts[] = array(
'board' => array(
'id' => $row['id_board'],
'name' => $row['board_name'],
'href' => $scripturl . '?board=' . $row['id_board'] . '.0',
'link' => '<a href="' . $scripturl . '?board=' . $row['id_board'] . '.0">' . $row['board_name'] . '</a>'
),
'topic' => $row['id_topic'],
'poster' => array(
'id' => $row['id_member'],
'name' => $row['poster_name'],
'href' => empty($row['id_member']) ? '' : $scripturl . '?action=profile;u=' . $row['id_member'],
'link' => empty($row['id_member']) ? $row['poster_name'] : '<a href="' . $scripturl . '?action=profile;u=' . $row['id_member'] . '">' . $row['poster_name'] . '</a>'
),
'subject' => $row['subject'],
'replies' => $row['num_replies'],
'views' => $row['num_views'],
'short_subject' => shorten_subject($row['subject'], 25),
'preview' => $row['body'],
'time' => timeformat($row['poster_time']),
'timestamp' => forum_time(true, $row['poster_time']),
'href' => $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . ';topicseen#new',
'link' => '<a href="' . $scripturl . '?topic=' . $row['id_topic'] . '.msg' . $row['id_msg'] . '#new" rel="nofollow">' . $row['subject'] . '</a>',
// Retained for compatibility - is technically incorrect!
'new' => !empty($row['is_read']),
'is_new' => empty($row['is_read']),
'new_from' => $row['new_from'],
'icon' => '<img src="' . $settings[$icon_sources[$row['icon']]] . '/post/' . $row['icon'] . '.gif" align="middle" alt="' . $row['icon'] . '" />',
);
}
$smcFunc['db_free_result']($request);

// Just return it.

$poster_ids = array();
foreach($posts as  $post)
$poster_ids[] = $post['poster']['id'];

$poster_ids = array_unique($poster_ids);
loadMemberData($poster_ids);

foreach($posts as $key => $post)
{
if($posts[$key]['poster']['id'] > 0)
{
loadMemberContext($posts[$key]['poster']['id']);
$posts[$key]['poster']['avatar'] = $memberContext[$posts[$key]['poster']['id']]['avatar']['image'];
$posts[$key]['poster']['title'] = $memberContext[$posts[$key]['poster']['id']]['title'];
}
else // Must be a guest.
{
$posts[$key]['poster']['avatar'] = '';
$posts[$key]['poster']['title'] = '';
}
}
unset($memberContext);

if ($output_method != 'echo' || empty($posts))
return $posts;

echo '
<table border="0" class="ssi_table">';
foreach ($posts as $post)
echo '
<tr>
<td align="right" valign="top" nowrap="nowrap">
[', $post['board']['link'], ']
</td>
<td valign="top">
<a href="', $post['href'], '">', $post['subject'], '</a>
', $txt['by'], ' ', $post['poster']['link'], '
', !$post['is_new'] ? '' : '<a href="' . $scripturl . '?topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new" rel="nofollow"><img src="' . $settings['lang_images_url'] . '/new.gif" alt="' . $txt['new'] . '" /></a>', '
</td>
<td align="right" nowrap="nowrap">
', $post['time'], '
</td>
</tr>';
echo '
</table>';
}

This is a code I created. It finds all the topics without posts and displays them.

Now, you'll need to create a php block using the portal software you have.

In the block, you can now call out the function like this:

Code:
global $scripturl, $context, $settings, $txt, $modSettings;

// leave out the recycle board, if any
if(isset($modSettings['recycle_board']))
$bb = array($modSettings['recycle_board']);
else
$bb = array();

$what = ssi_unansweredTopics('30', $bb, 'array');

// Output the topics
echo '
<ul class="recent_topics" style="overflow: auto; margin-top: -1ex; padding: 0;">';

$coun = 1;

foreach($what as $wi => $w)
{
echo '
<li' , $coun<count($what) ? ' style="border-bottom: dashed 1px #bbb;"' : ' style="border: none; margin-bottom: 0; padding-bottom: 0; list-style-type: none;"'  , '>
<!--This should not be here, but I added it to include avatars-->
<span class="tpavatar"><a href="' . $scripturl. '?action=profile;u=' . $w['poster']['id'] . '">';

$w['poster']['avatar'] = str_replace('src','style="width: 35px; height: 35px;" src', $w['poster']['avatar']);

echo'',$w['poster']['id'] == '0' ? '<img src="'.$modSettings['default_avatar_url'].'" alt="default">' : $w['poster']['avatar'],'</a></span>

<a href="' . $w['href'] . '" title="' . $w['subject'] . '">' . $w['subject'] . '</a>
<br/>Started ', $txt['by'], ' <b>', $w['poster']['link'],'</b> in <i>' . $w['board']['link'] . '</i> ';
if(!$w['new'])
echo ' <a href="'.$w['href'].'"><img src="'. $settings['images_url'].'/'.$context['user']['language'].'/new.gif" alt="new" /></a> ';

echo '<br /><span class="smalltext">['.$w['time'].']</span>
</li>';
$coun++;
}
echo '
</ul>';

Then, add this to your style sheet:

Code:
ul.recent_topics li
{
padding: 4px;
margin: 0;
margin-bottom: 4px;
border-bottom: solid 1px #bbb;
font-size: 1em;
overflow: hidden;
}

Now you should have a block with unanswered questions. I hope this serves as a frame work for the rest. Bottom line, SSI functions will become your new best friend Wink Face
drfun Author
wrote...
10 years ago
This is all some thanks, i will start with this on my site,am still a beginner in coding, but with this your guide i know i will achieve this. thanks a million
All Student Forum
wrote...
Educator
10 years ago
This is all some thanks, i will start with this on my site,am still a beginner in coding, but with this your guide i know i will achieve this. thanks a million

I understand. Coding isn't really that difficult, it just takes time getting used to.

Good luck.
drfun Author
wrote...
10 years ago Edited: 10 years ago, drfun
Thanks again.
i have done as you have asked, but i could not locate the style sheet on my cpanel, but in my forum admin panel, under theme modification i was able to see the Edit style sheet, when i click on it, there are 2 files namely
1. index.css
2. rtl.css

in the style sheet.

Now i dont know which of them that i should add this code
Quote
ul.recent_topics li
{
   padding: 4px;
   margin: 0;
   margin-bottom: 4px;
   border-bottom: solid 1px #bbb;
   font-size: 1em;
   overflow: hidden;
}

to on the style sheet

All Student Forum
wrote...
Educator
10 years ago
Firstly, let's start with a proper working/coding environment.

1) Download Notepad++

2) Connect to your server using FileZila (download that too).

Using FileZila, you should be able to local style.css that your theme uses, not the default. Once you locate it, download it onto your computer and start editing it with Notepad++.
drfun Author
wrote...
10 years ago
i have the filezilla and the note pad editor ready. with the filezilla, i was not able to locate the style.css, the theme i am using is vertex and i have gone through all the files and folders on the theme but i could not see style.css. Here is a screen shot of the filezilla
 Attached file 
Thumbnail(s):
You must login or register to gain access to this attachment.
All Student Forum
wrote...
Educator
10 years ago
Check the CSS folder. It should be in there.
drfun Author
wrote...
10 years ago
There are only 2 files in the CSS folder which are index.css and rtl.css
All Student Forum
wrote...
Educator
10 years ago
Hi drfun,

Sorry for the late reply. I'm assuming index.css is the correct file. Therefore, add the style codes I provided to the bottom of it.

Did you follow the other instructions I provided?
drfun Author
wrote...
10 years ago Edited: 10 years ago, drfun
Quote
Sorry for the late reply.
No problem

Quote
I'm assuming index.css is the correct file.
ok, i have inserted it on the index.css, but i did not notice any change in the style, the style is still the same as it was before. However here is the result of what you have thought me so far and thanks again.
Another thing i noted it did not also separate like yours into

Subject                                           Author                                            Date


instead it just list beside the post.
Post Merge: 10 years ago

Also since i am working with one portal block, i will it to appear like this that you have done here?
 Attached file(s) 
Thumbnail(s):
You must login or register to gain access to these attachments.
All Student Forum
wrote...
Educator
10 years ago
ok, i have inserted it on the index.css, but i did not notice any change in the style, the style is still the same as it was before. However here is the result of what you have thought me so far and thanks again.
Another thing i noted it did not also separate like yours into

Subject                                           Author                                            Date

instead it just list beside the post.

You'll need to play around with the styling to get it the way you want. In order to create tabs, like I've done, you'll need to follow this tutorial:

http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm

I used this to create the "tab" effect.

By the way, the vertex them you've used is quite attractive!
  New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  1115 People Browsing
 125 Signed Up Today
Related Images
  
 512
  
 502
  
 467
Your Opinion
Which 'study break' activity do you find most distracting?
Votes: 741