Author Topic: Comment Counter  (Read 23299 times)

0 Members and 1 Guest are viewing this topic.

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Comment Counter
« on: August 16, 2005, 05:37:34 PM »
Hello
i look for the code which say total comment: 18

i would like to add this information to the side navigationbar!

thanks for feedback

vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: Comment Counter
« Reply #1 on: August 16, 2005, 07:54:34 PM »
You mean this one :

Quote

{image_comments}


?

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Comment Counter
« Reply #2 on: August 16, 2005, 07:58:27 PM »
{image_comments}
added this {image_comments} what is the result?
i would like to have as result in my case now 18 because i have 18comments!

vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: Comment Counter
« Reply #3 on: August 16, 2005, 08:01:13 PM »
You'd like to add this starting from the index page right ?

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Comment Counter
« Reply #4 on: August 16, 2005, 08:03:06 PM »
yes from the index page but also categorie detail page and so one - it stay on the left side in the navig list
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Comment Counter
« Reply #5 on: August 16, 2005, 08:04:57 PM »
http://www.4homepages.de/forum/index.php?topic=9283.0
the link which V@no gave the code for the lightbox counter in the navig
works only if registerd this MOD

this now requested mod should also work for all guest
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: Comment Counter
« Reply #6 on: August 16, 2005, 08:27:39 PM »
If the comments has not been populated like the lightbox yet (as I said: If), then - in that case - additional codings from includes/functions.php file would need to be done since, for the lightbox, it uses the lightbox_image_ids on many lightbox actions.

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Comment Counter
« Reply #7 on: August 16, 2005, 10:33:32 PM »
hallo vincent,

... also ein Kommentar-Counter in der home.html (bzw. auf allen Hauptseiten) ...
... dann hätte ich dieses für dich ... getestet und funktionstüchtig ...  :wink:

folgendes in die includes/page_header.php vor :
Code: [Select]
?>

einsetzen :
Code: [Select]
//-----------------------------------------------------
//--- Kommentar-Counter ---
//-----------------------------------------------------
  $sql = "SELECT SUM(image_comments) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_comments = $row['sum'];
   
  $site_template->register_vars("total_comments", $total_comments);
  unset($total_comments);

nun kannst du in der home.html (deiner Navigationsbar) bzw. allen html-Hauptseiten folgendes als Counter verwenden :
Code: [Select]
Anzahl der Kommentare : {total_comments}

das sollte es gewesen sein ... ist aber zunächst nur einsprachig ... und ich denke du brauchst es nur in deutsch ...  :wink:
(es werden nun noch Vorschläge mit ... $lang_total_comments ... von :?: kommen ...  :mrgreen: )

mawenzi
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) ...

TheOracle

  • Guest
Re: Comment Counter
« Reply #8 on: August 17, 2005, 05:00:06 AM »
I already tried coding that one ... does it actually work ?

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Comment Counter
« Reply #9 on: August 17, 2005, 10:21:45 AM »
hi TheOracle

it works absolutely perfect ...  :wink:

mawenzi
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) ...

TheOracle

  • Guest
Re: Comment Counter
« Reply #10 on: August 17, 2005, 11:38:25 AM »
I found my mistake.

I stated :

Quote

$sum = (isset($row['sum'])) ? $row['sum'] : "";


rather than :

Code: [Select]

$sum = (isset($row['sum'])) ? $row['sum'] : 0;


Thanks for posting this. ;)

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Comment Counter
« Reply #11 on: August 17, 2005, 11:49:53 PM »
i am to stupied - how to add the {total_comments} code into a php file?

Code: [Select]
<tr> 
    <td width="100%" align="center" height="20" background="templates/4dark/bbutton.gif">
<div align="left">
<a style="text-decoration: none" href="soldpubl.php">&gt; Verkaufte Fotos {total_comments}</a>
</div>
    </td>
</TR>

Vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: Comment Counter
« Reply #12 on: August 17, 2005, 11:55:54 PM »
May I ask why this should be added into PHP files rather than HTML files ?

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: Comment Counter
« Reply #13 on: August 17, 2005, 11:58:39 PM »
because the hole navig list is a php file!  :wink:

i am not the coder just a user - so don't ask me - until know it is just fine working like this

vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: Comment Counter
« Reply #14 on: August 18, 2005, 12:04:43 AM »
Hum ... to be safe, let's rather do it like this :

Code: [Select]

//-----------------------------------------------------
//--- Kommentar-Counter ---
//-----------------------------------------------------
  $sql = "SELECT SUM(image_comments) AS sum
          FROM ".IMAGES_TABLE;
  $row = $site_db->query_firstrow($sql);

  $sum = (isset($row['sum'])) ? $row['sum'] : 0;
  $total_comments = $row['sum'];
   
  $site_template->register_vars("total_comments", $total_comments);

  $site_template->parse_template("total_comments_page");

  unset($total_comments);


Then, create a file called : total_comments_page.html in your templates/<your_template> folder and paste your posted HTML content in that file.

Should work from there. ;)

 

Post your comments here