Hi , just want a little help
What i want to do is if a thread is locked i want to display it differently, will it be possible to do this with IF and ELSE statements ?
I want to change the class and the colspan, and not real sure how to go about it :(
This is the Code
foreach ($context['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="windowbg' , $topic['is_sticky'] ? '8' : '7' , '" valign="middle" align="center" width="4%">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="windowbg', !empty($settings['seperate_sticky_lock']) && $topic['is_sticky'] ? '8' : '7' , '" valign="middle" ', (!empty($topic['quick_mod']['remove']) ? 'id="topic_' . $topic['first_post']['id'] . '" onmouseout="mouse_on_div = 0;" onmouseover="mouse_on_div = 1;" ondblclick="modify_topic(\'' . $topic['id'] . '\', \'' . $topic['first_post']['id'] . '\', \'' . $context['session_id'] . '\');"' : ''), '>';
if (!empty($settings['seperate_sticky_lock']))
echo '
' , $topic['is_locked'] ? '<img src="' . $settings['images_url'] . '/icons/quick_lock.gif" align="right" alt="" id="lockicon' . $topic['first_post']['id'] . '" style="margin: 0;" />' : '' , '
' , $topic['is_sticky'] ? '<img src="' . $settings['images_url'] . '/icons/show_sticky.gif" align="right" alt="" id="stickyicon' . $topic['first_post']['id'] . '" style="margin: 0;" />' : '';
echo '
', $topic['is_sticky'] ? '' : '' , '<span style="',$topic['new'] ? 'font-weight:bold;' : 'font-weight:500;', '" id="msg_' . $topic['first_post']['id'] . '">', $topic['first_post']['link'], '</span>', $topic['is_sticky'] ? '' : '';
// Is this topic new? (assuming they are logged in!)
echo '
<small id="pages' . $topic['first_post']['id'] . '">', $topic['pages'], '<a href="', $topic['last_post']['href'], '"> (last)</a></small></td><td class="windowbg' , $topic['is_sticky'] ? '8' : '7' , '" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg' , $topic['is_sticky'] ? '7' : '8' , '" valign="middle" width="4%" align="center">
', $topic['replies'], '
</td>
<td class="windowbg' , $topic['is_sticky'] ? '7' : '8' , '" valign="middle" width="4%" align="center">
', $topic['views'], '
</td><td class="windowbg' , $topic['is_sticky'] ? '8' : '7' , '" valign="middle" align="center" width="12%"><span class="smalltext"><b>
', $topic['first_post']['member']['link'], '</b><br /></span></td>
<td class="windowbg' , $topic['is_sticky'] ? '8' : '7' , '" valign="middle" align="center" width="200px">
<span class="smalltext"><b>
', $topic['last_post']['member']['link'], '</b><br />', $topic['last_post']['time'], '
</span>
</td>';
What colspan? What class?
The variable you would want to use is: $topic['is_locked']
if ($topic['is_locked'])
{
<do_something>;
}
Lainaus käyttäjältä: akabugeyes - marraskuu 12, 2007, 11:20:41 AP
What colspan? What class?
Not sure yet .... :D
Basically , going to change the link color and backgoround with the class, and probably remove the first poster , last poster views columns etc..
Lainaus käyttäjältä: akabugeyes - marraskuu 12, 2007, 11:20:41 AP
if ($topic['is_locked'])
{
<do_something>;
}
Ok would i replace the <do_something> with the whole code i posted in the original post with the changed colspan and class, or would that be over kill ?
edit: Ok something like this ?
if ($topic['is_locked'])
{
<new class , colspan>;
} else {
<old code>;
}
Ok worked beautifully Thanks very much :D
This is what I did with it

http://www.racehorsetalk.com.au/deleted.jpg (http://www.racehorsetalk.com.au/deleted.jpg)
Ok there are a couple of other things i want to do with it
The first being i want to display the last message of the thread from display.template.php in MessageIndex.Template.php.
Is there a single variable or an easy way of doing this ??
As the Admin i basically want to be able to close the thread (delete it) by locking it and give the reason for locking it (deleting it) in the last post, and then display the reason (Last Post) next to the thread name in MessageIndex.Template.php
The next thing i want to do is only allow the admin to click the link of the post, so this way members can no longer see the thread, just the thread name and the reason it was deleted.
The whole idea is to delete a thread with out actually deleting the thread, this way members can see what was deleted and why, and it will be easy to un-delete the thread by just unlocking it ;)
Do you have the separate stick and locked topics checkec?
This code should setup a new class if it is.
if (!empty($settings['seperate_sticky_lock']) && strpos($topic['class'], 'sticky') !== false)
$topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));