Author Topic: [Style] Hide {comments} and {comment_form} tag until first comment made  (Read 5549 times)

0 Members and 1 Guest are viewing this topic.

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Hi,

i like hide the {comments} tag if there is no comment available.
So is it possible to make for example that tag available?:

Code: [Select]
{if comment_available} blubbel...bla {if comment_available}

Greetz X23
« Last Edit: November 18, 2010, 03:18:37 AM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
... deine Fragestellung leuchtet mir noch nicht ganz ein ...
? ... wenn es keine Kommentare gibt, so willst du sie nicht anzeigen lassenn ... ? ... das übernimmt 4images schon standardmäßig ... ;)

... den {if tag} .... {endif tag} bzw. {ifno tag} .... {endifno tag} kannst du für alle definierten Tags in den Templates einsetzen ...
... entweder du greifst auf standadmäßig definierte Tags zurück, oder du musst selbst welche z.B. in der functions.php definieren ...

... für die Abhängigkeit von Kommentaren wäre zum Beispiel in der details.html folgendes möglich ...
... {if comments} Es sind bereits Kommentare zu diesesem Bild gepostet worden. {endif comments} ...
... und als Gegenteil ...
... {ifno comments} Es sind noch keine Kommentare zu diesesem Bild gepostet worden. {endifno comments} ...
... wenn du dann beides zusammen verwendest, dann wird eben nur der jeweils entsprechende Text zu sehen sein ...
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Hi,

ich will wenn keine Kommentare vorhanden alles was mit den Kommentaren zu tun hat durch
ein div ausblenden.

Ich brauche etwas das prüft ob zu dem Bild überhaupt schon ein Kommentar existiert und wenn nicht
werden alle Tabellen die ja auch leer angezeigt werden ausgeblendet bis jemand einen kommentar
abgegeben hat.

Ich will unnützen inhalt ausblenden.

Ein Bild hilft vielleich eher:



Das wird immer angezeigt ob ein Kommentar existiert oder nicht, das soll so lange weg bis der
erste existiert. :)

Ich finde es viel logischer als den User mit der Info zu nerven das kein Kommentar existiert obwohl
er das offensichtlich sieht... außer natürlich er ist das allererste mal auf der Seite und sieht nur Bilder
die noch keine Kommentare haben... aber bitte ;)


Gruß Jens

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
In details.php find:
  if (!$num_comments) {

Insert above:
  $site_template->register_vars("comments_available", ($num_comments));

in template use {if comments_available} ... {endif comments_available}
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
@x23piracy 

... Problematik jetzt verstanden ...
... V@no zeigt dir jetzt die Lösung ... er definiert einen neuen Tag ... {comments_available} ... auf der Gundlage der Anzahl der Kommentare ...
... wenn dieser Tag nun "0" ist und du {if comments_available} ... {endif comments_available} verwendest, dann wird alles zwischen diesen Tags ausgeblendet ...
... da dieser Tag in der details.php definiert wird, kannst du ihn auch nur in der details.html verwenden ...
 
 
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
In details.php find:..

@x23piracy  

Hi,

das nenn ich mal Lehrstunde Danke euch beiden.
It works :thumbup:

Mal abgesehen von V@no's Tip habe ich das so eingebaut:

Code: [Select]
{if comments_available}
{if allow_comments}
<br />

<a name="comments"></a>
<div class="commentbox">
<table width="500px" border="0" cellpadding="3" cellspacing="1">
<tr>
<td valign="top"><strong>{lang_author}</strong></td>
<td valign="top"><strong>{lang_comment}</strong></td>
</tr>
{comments}
</table>
</div>
{comment_form}

{endif allow_comments}
{endif comments_available}

Ich habe mal die Überschrift verändert, falls das nochmal jemand braucht,
ggf. verschieben?


Gruß Jens
« Last Edit: November 18, 2010, 03:20:19 AM by x23piracy »

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--