Member
Member
DaMsT   17-10-2007, 16:10
#1

Hi,

I'm new here and a bit confused right now. I want to add the 3 latest comments to my gallery-indexpage. I found http://www.zenphoto.org/trac/wiki/ZenphotoHacks#RecentCommentsCustomFunction but my php knowledge is limited and the FAQ didn't help much. In other words I have no clue how to add this function to my gallery. So can anyone point me in the right direction?

Thanks!

Member
Member
aitf311   17-10-2007, 17:19
#2

If you have a custom-functions file you can drop that code in there, otherwise you can put it in template-functions.php. After youve done this you can put in your theme page to show the 3 latest comments.

It is recommended that you put this code in a file called custom-functions.php and include it at the top of your theme files using this code:
What this will do is allow you to upgrade zenphoto without having to modify the zenphoto code every time you upgrade.

Member
Member
DaMsT   18-10-2007, 14:46
#3

Ah thank you!

Member
Member
zucye   30-12-2007, 02:30
#4

I would also like to show the lates comments in my index.php. But the spinnet is not working because it contains "zp_conf"

Can anyone take a look at it and fix it. Thanks in advance!

/ Show Latest Comments /
/ http://anton.gektoras.lt/2007/05/15/zenphoto-addons/ /

function my_truncate_string($string, $length) {
if (strlen($string)> $length) {
$short = substr($string, 0, $length);
return $short. '...';
} else {
return $string;
}
}

function printLatestComments($number) {
echo '';
echo '
[list]';
$comments = query_full_array("SELECT c.id, i.title, i.filename, a.folder, a.title AS albumtitle, c.name, c.website,"
. " c.date, c.comment FROM ".prefix('comments')." AS c, ".prefix('images')." AS i, ".prefix('albums')." AS a "
. " WHERE c.imageid = i.id AND i.albumid = a.id ORDER BY c.id DESC LIMIT $number");
foreach ($comments as $comment) {
$author = $comment['name'];
$album = $comment['folder'];
$image = $comment['filename'];
$albumtitle = $comment['albumtitle'];
if ($comment['title'] == "") {
$title = $image;
} else {
$title = $comment['title'];
}
$website = $comment['website'];
$comment = my_truncate_string($comment['comment'], 40);
$link = $author.' commented on '.$albumtitle.' / '.$title ;
$short_link = my_truncate_string($link, 40);
echo '
[*]

Member
Member
sbillard   30-12-2007, 06:00
#5

The zp_conf array has been eliminated now that options are stored in the database. Use instead getOption('mod_rewrite')

On the other hand, there is a function for this: printLatestComments($number) which you might rather use. It is part of template-functions.php.

We are hard at work and should shortly have an updated function guide posted on the zenphoto site.

Member
Member
zucye   31-12-2007, 02:05
#6

Nice sbillard, that is exactly what I meant when I said I needed some parameters. A list of funciton would be superb!!!!!!

Member
Member
sbillard   31-12-2007, 05:39
#7

http://www.zenphoto.org/documentation/default/_template-functions.php.html

It is still being worked on, but is pretty complete.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.