SMF Support > FAQ & Tutorials

[Tutorial] neue Themen - Hintergrundfarbe ändern

(1/3) > >>

noex:
Um in der Themenübersicht neue Beiträge farblich hervorzuheben (Standardmäßig wird nur ein "neu" Symbol angezeigt) muss man in einer Template Datei eine kleine Änderung machen.

Anleitung für

* SMF 1.0.5 (ohne neu Icon / default Theme)
* SMF 1.0.5 (mit neu Icon / default Theme)
* SMF 1.1 RC 1 (mit neu Icon / default Theme)
* SMF 1.1 RC 2 (mit neu Icon / default Theme)
* SMF 1.1 RC 2 (mit neu Icon / babylon Theme)
Hier noch ein Screenshot zum verdeutlichen:

noex:
SMF 1.0.5 (ohne "neu" Symbol)

Suche in der MessageIndex.template.php nach folgenden Code:

--- Code: --- foreach ($context['topics'] as $topic)
{
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="4%">
<img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
</td>
<td class="windowbg" valign="middle">
', $topic['first_post']['link'];

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['id'], '.from', $topic['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

echo '
<span class="smalltext">', $topic['pages'], '</span>

--- End code ---
und ersetze diesen mit:

--- Code: --- foreach ($context['topics'] as $topic)
{
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '  <tr class="new">';
else
echo '  <tr>';

echo '
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="4%">
<img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
</td>
<td class="windowbg" valign="middle">
', $topic['first_post']['link'];


echo '
<span class="smalltext">', $topic['pages'], '</span>


--- End code ---

In deiner style.css fügst du am ende folgendes hinzu:

--- Code: ---.new, tr.new td, .new a:link, .new a:visited
{
color: #000000;
font-style: normal;
background-color: #FFCC66;
}

--- End code ---

noex:
SMF 1.0.5 (mit "neu" Symbol)

Suche in der MessageIndex.template.php nach folgenden Code:

--- Code: --- foreach ($context['topics'] as $topic)
{
echo '
<tr>
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="4%">
<img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
</td>
<td class="windowbg" valign="middle">
', $topic['first_post']['link'];

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['id'], '.from', $topic['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

echo '
<span class="smalltext">', $topic['pages'], '</span>

--- End code ---
und ersetze diesen mit:

--- Code: --- foreach ($context['topics'] as $topic)
{
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '  <tr class="new">';
else
echo '  <tr>';

echo '
<td class="windowbg2" valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td class="windowbg2" valign="middle" align="center" width="4%">
<img src="', $settings['images_url'], '/post/', $topic['first_post']['icon'], '.gif" alt="" />
</td>
<td class="windowbg" valign="middle">', $topic['first_post']['link'];

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $scripturl, '?topic=', $topic['id'], '.from', $topic['newtime'], '#new"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

echo '
<span class="smalltext">', $topic['pages'], '</span>


--- End code ---

In deiner style.css fügst du am ende folgendes hinzu:

--- Code: ---.new, tr.new td, .new a:link, .new a:visited
{
color: #000000;
font-style: normal;
background-color: #FFCC66;
}

--- End code ---

noex:
SMF 1.1 RC1 (mit "neu" Symbol)

Suche in der MessageIndex.template.php nach folgenden Code:

--- Code: --- foreach ($context['topics'] as $topic)
{
echo '
<tr class="windowbg2">
<td valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td valign="middle" align="center" width="4%">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="windowbg" valign="middle">
', $topic['first_post']['link'];

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $topic['new_href'], '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

echo '
<span class="smalltext">', $topic['pages'], '</span>

--- End code ---

und ersetze diesen mit:

--- Code: --- foreach ($context['topics'] as $topic)
{
// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '  <tr class="new">';
else
echo '  <tr class="windowbg2">';

echo '
<td valign="middle" align="center" width="5%">
<img src="', $settings['images_url'], '/topic/', $topic['class'], '.gif" alt="" />
</td>
<td valign="middle" align="center" width="4%">
<img src="', $topic['first_post']['icon_url'], '" alt="" />
</td>
<td class="windowbg" valign="middle">
', $topic['first_post']['link'];

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
echo '
<a href="', $topic['new_href'], '"><img src="', $settings['images_url'], '/', $context['user']['language'], '/new.gif" alt="', $txt[302], '" border="0" /></a>';

echo '
<span class="smalltext">', $topic['pages'], '</span>

--- End code ---

In deiner style.css fügst du am ende folgendes hinzu:

--- Code: ---.new, tr.new td, .new a:link, .new a:visited
{
color: #000000;
font-style: normal;
background-color: #FFCC66;
}
--- End code ---

noex:
SMF 1.1 RC2 (mit "neu" Symbol / default Theme)

Suche in der MessageIndex.template.php nach folgenden Code:

--- 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="windowbg2" valign="middle" align="center" width="5%">

--- End code ---

und ersetze diesen Code mit:

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

// Is this topic new? (assuming they are logged in!)
if ($topic['new'] && $context['user']['is_logged'])
    echo '  <tr class="new">';
else
    echo '  <tr class="windowbg2">';

echo '
<td class="windowbg2" valign="middle" align="center" width="5%">

--- End code ---

In deiner style.css fügst du am ende folgendes hinzu:

--- Code: ---.new, tr.new td, .new a:link, .new a:visited
{
color: #000000;
font-style: normal;
background-color: #FFCC66;
}
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version