Member
Member
R182   2009-11-06, 20:38
#1
hello,

first: sorry for my english. i speak german :-)

i have a problem:

in the admin userface on the right side is a box with "The last 10 Comments"
Now i want to put this box in a other side of my zenphoto gallerie.

The Problem is, i can`t. i saw here a "Tutorial" but i can't the script import in my webpage. maybe i'm to stupide?!?

is anyone here can show me a functioning script?

Thanks. Now i wish you a nice evening.
Member
Member
kagutsuchi   2009-11-06, 20:47
#2
You can use the function `printLatestComments()` to print however many comments you specify. You can read more in the here in the functions documentation: http://www.zenphoto.org/documentation/functions/_template-functions.php.html#functionprintLatestComments
Member
Member
R182   2009-11-06, 21:20
#3
now i found the script in the template-functions.php file.

when i this script import in my page then i see a white site

Why? The script is still ok?

this is "my" script

<?php

/**
* Prints out latest comments for images and albums
*
* @param int $number how many comments you want.
* @param string $shorten the number of characters to shorten the comment display
* @param string $type "all" for all latest comments of all images and albums
* "image" for the lastest comments of one specific image
* "album" for the latest comments of one specific album
* @param int $itemID the ID of the element to get the comments for if $type != "all"
*/
function printLatestComments($number='20', $shorten='123',$type="all",$itemID="") {
if(getOption('mod_rewrite')) {
$albumpath = "/"; $imagepath = "/"; $modrewritesuffix = getOption('mod_rewrite_image_suffix');
} else {
$albumpath = "/index.php?album="; $imagepath = "&image="; $modrewritesuffix = "";
}
$comments = getLatestComments($number,$type,$itemID);
echo "<ul id=\"showlatestcomments\">\n";
foreach ($comments as $comment) {
if($comment['anon'] === "0") {
$author = " ".gettext("by")." ".$comment['name'];
} else {
$author = "";
}
$album = $comment['folder'];
if($comment['type'] != "albums" AND $comment['type'] != "news" AND $comment['type'] != "pages") { // check if not comments on albums or Zenpage items
$imagetag = $imagepath.$comment['filename'].$modrewritesuffix;
} else {
$imagetag = "";
}
$date = $comment['date'];
$albumtitle = $comment['albumtitle'];
if ($comment['title'] == "") $title = $image; else $title = get_language_string($comment['title']);
$website = $comment['website'];
$shortcomment = truncate_string($comment['comment'], $shorten);
if(!empty($title)) {
$title = ": ".$title;
}
echo "
[*]<a>".$albumtitle.$title.$author."</a>\n";
echo "<span class=\"commentbody\">".$shortcomment."</span>
";
}
echo "\n";
}

?>
Member
Member
kagutsuchi   2009-11-06, 21:29
#4
You don't have to change the function at all or import anything. You just need to make a call to the function where you want the comments to be displayed.
Member
Member
R182   2009-11-06, 21:51
#5
ok

now i imported in the image.php file (themes/default/...) this script

<?php void printLatestComments( int $number = "10"], [string $shorten = '123'], [string $type = "all"], [int $itemID = ""] ) ?>

And then my browser saw:

Parse error: syntax error, unexpected T_STRING in /home/www/my ordner.../themes/default/image.php on line 87

what is fals on my idea to import this script?
Member
Member
micheall   2009-11-06, 23:59
#6
You would want to use it like:

<?php void printLatestComments( 10, 123, "all", "") ?>
Member
Member
micheall   2009-11-07, 02:02
#7
Edit: wasn't paying atention, you're actually not going to want the "void" in there either. So you would want:

<?php printLatestComments( 10, 123, "all", "") ?>
Member
Member
kagutsuchi   2009-11-07, 02:31
#8
You're also missing a semicolon. The correct code is:

`<?php printLatestComments(10, 123, 'all', ''); ?>`
Member
Member
micheall   2009-11-07, 03:27
#9
yeah what he put... lol, I had the semicolon in my code, just kept forgetting to add it here. Thanks for catching that kagutsuchi
  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.