Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: [Solved]: Number of comments below thumbnail?  (Read 6544 times)

0 Members and 1 Guest are viewing this topic.

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Online Online
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
[Solved]: Number of comments below thumbnail?
« on: July 28, 2008, 10:19:11 pm »

Hi all,

I'm running SMF 1.1.5 / Tinyportal 0.9.8, bridged with Coppermine 1.4.18, and currently using coppermineFetch to pull images on to my front page (Latest gallery images).  I have searched but not found the answer.

Is it possible, and can someone tell me what code I need to show the number of comments under each thumb? please.  So far I have it showing the title, who uploaded the pic, and the number of views. 

Code I'm using as follows, Added to a center phpbox in Tinyportal.

Code: [Select]
echo "<center>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";                   
$objCpm = new cpm();
$options = array("imageheight"=>"80","subtitle" => "<center>{{pTitle}} <br> {{pHits}} Views <center> <FONT color=#ff0000 size=2>Image By</FONT></STRONG> <br> {{pOwner_name}}</center>");
$objCpm->cpm_viewLastAddedMedia(2,4,$options,$filter);
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://cameracraniums.com/gallery?action=gallery">View more latest images</a>';
echo "</center>";

And a link to my site, www.cameracraniums.com
« Last Edit: July 30, 2008, 12:49:07 pm by Nibbler »
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Number of comments below thumbnail?
« Reply #1 on: July 28, 2008, 10:47:01 pm »

What MySQL version?
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Online Online
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Number of comments below thumbnail?
« Reply #2 on: July 28, 2008, 11:31:32 pm »

What MySQL version?

Thanks, according to my server control panel it's,  5.0.51a-community
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Number of comments below thumbnail?
« Reply #3 on: July 29, 2008, 10:54:01 am »

Edit your cpmfetch_config.php file, look for

Code: [Select]
'cfSQLPictureSelect' => 'p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.cid as cCid, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb',

And add something to get the comment count, like this:

Code: [Select]
'cfSQLPictureSelect' => 'p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.cid as cCid, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, (SELECT COUNT(*) FROM ' . $this->cfg['table_prefix'] . 'comments WHERE pid = p.pid) AS pComCount',

If the variable doesn't work then hardcode the name of the comments table.

You should then be able to use {{pComCount}} to get the number of comments.
« Last Edit: July 30, 2008, 11:31:47 am by Nibbler »
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Online Online
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Number of comments below thumbnail?
« Reply #4 on: July 30, 2008, 09:49:20 am »

Thanks for trying to help.  I added the code you gave to my cpmfetch_config.php file, but it just displays the error message below

Quote
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE pid = p.pid) AS pComCount, a.aid AS aAid, a.title AS aTitle, a.description' at line 1
SELECT p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.cid as cCid, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, (SELECT COUNT(*) FROM WHERE pid = p.pid) AS pComCount, a.aid AS aAid, a.title AS aTitle, a.description AS aDescription, a.visibility as aVisibility, a.pos as aPos, a.category as aCategory, a.thumb as aThumb, a.keyword as aKeyword FROM cpg_pictures AS p LEFT JOIN cpg_albums AS a ON p.aid = a.aid LEFT JOIN cpg_categories AS c ON a.category = c.cid WHERE 1 AND p.approved='YES' AND ((a.visibility = 0 OR a.visibility IS NULL) AND (a.alb_password IS NULL OR a.alb_password = "")) ORDER BY p.ctime DESC LIMIT 0,8

Can you tell me how to hardcode the name of the comments table, I haven't a clue where to start.  :-[
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0

Nibbler

  • Guest
Re: Number of comments below thumbnail?
« Reply #5 on: July 30, 2008, 11:31:28 am »

Like this:

Code: [Select]
'cfSQLPictureSelect' => 'p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.cid as cCid, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, (SELECT COUNT(*) FROM cpg_comments WHERE pid = p.pid) AS pComCount',
Logged

lurkalot

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Online Online
  • Gender: Male
  • Posts: 949
  • +Tinyportal Support team.
Re: Number of comments below thumbnail?
« Reply #6 on: July 30, 2008, 12:04:14 pm »

Thank you Nibbler, that has worked nicely.  ;)
Logged
Running SMF 2.1.4  / Tinyportal 3.0.0, bridged with Coppermine 1.6.25, plus cpmfetch 2.0.0
Pages: [1]   Go Up
 

Page created in 0.099 seconds with 19 queries.