Simple Machines Community Forum

SMF Support => Hilfe zu SMF (German) => Language Specific Support => Grafiken & Templates => Topic started by: Blickhaus on January 04, 2011, 09:36:29 AM

Title: Hinzufügen eines NEU-icons
Post by: Blickhaus on January 04, 2011, 09:36:29 AM
Hi zusammen...

nachdem mir im smfportal niemand helfen kann und im englischen Forum auch keine Reaktionen folgen,
probier ich es nun hier nocheinmal!

-SMF 1.1.12

Ich möchte in der ersten Spalte meiner Unterforen anzeigen lassen, dass ein neuer Beitrag vorhanden ist.
Die Anzeige von "neu" hinter dem Betreff habe ich bereits entfernt.

Mein Gedanke ist es, dass es nach dem gleichen Prinzip funktioniert, wie das Forum per php
die Grafiken auswählt wenn ein Topic Sticky und/oder Geschlossen ist (xxx_sticky.png, xxx_sticky_closed.png, etc...
xxx steht zB für normal_post oder my_hot_poll, etc...).

Folgenden Code habe ich in der Messageindex.template gefunden:


if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'sticky') !== false)
          $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'locked') !== false)
          $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));


Daraus hab ich dann das gemacht:


if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'sticky') !== false)
         $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'locked') !== false)
         $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));
if ($topic['new'] && $context['user']['is_logged'])
         $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_new'));


Aber leider bleibt die Spalte leer bei neuen Beiträgen... das Forum sucht eine Grafik namens "normal.png"
wobei die absolute Standardgrafik "normal_post.png" und mein Ziel die "normal_post_new.png" ist.

Das komplette Template findet ihr hier: http://www.kdf-malfurion.eu/MessageIndex.template1.php.txt

Es wäre schön, wenn mir hier jemand helfen könnte!

Liebe Grüße



edit:

Hier noch die Zeile, die das Icon ausspuckt...

<img src="', $settings['images_url'], '/topic/', $topic['class'], '.png" alt="" />

nochmal edit:

Bei

if ($topic['new'] && $context['user']['is_logged']) && strpos($topic['class'], 'new') !== false)
           $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_new'));
if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'sticky') !== false)
           $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'locked') !== false)
            $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));

Kommt ein Temporate Parse Error!!

edit: gelöst
Title: Re: Hinzufügen eines NEU-icons
Post by: Blickhaus on January 05, 2011, 03:44:11 AM
Ok, hab die Lösung gefunden... wirklich zu simpel!

Dem hier

if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'sticky') !== false)
           $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_sticky'));
if (!empty($settings['seperate_sticky_lock_opt']) && strpos($topic['class'], 'locked') !== false)
            $topic['class'] = substr($topic['class'], 0, strrpos($topic['class'], '_locked'));


hab ich folgende Zeilen hinzugefügt

if ($topic['new'] && $context['user']['is_logged'])
           $topic['class'] .= '_new';

(ja, wirklich .=)

Nun kann ich meinen Icongrafiken ein _new vor die Dateiendung packen
und er zeigt mir neue Beiträge in den Unterforen genau so an, wie ich's will  8)

Wenn jemand ein ähnliches Vorhaben hat, hoffe ich, dass ich damit helfen konnte...

Liebe Grüße