SMF Support > Grafiken & Templates

Hinzufügen eines NEU-icons

(1/1)

Blickhaus:
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:


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

--- End code ---

Daraus hab ich dann das gemacht:


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

--- End code ---

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: hxxp:www.kdf-malfurion.eu/MessageIndex.template1.php.txt [nonactive]

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

Liebe Grüße



edit:

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


--- Code: ---<img src="', $settings['images_url'], '/topic/', $topic['class'], '.png" alt="" />
--- End code ---

nochmal edit:

Bei

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

--- End code ---
Kommt ein Temporate Parse Error!!

edit: gelöst

Blickhaus:
Ok, hab die Lösung gefunden... wirklich zu simpel!

Dem hier

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

--- End code ---

hab ich folgende Zeilen hinzugefügt

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

--- End code ---
(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

Navigation

[0] Message Index

Go to full version