Hi,

Currently we have only a link to comments page of the gallery. I thought that it would be great to have normal Drupal block that shows last comments in the gallery. This would stimulate to adding more comments to gallery and help to better a sense of community.

Could the maintainers of the module develop such a block, please.

Thanks for attention.

Comments

mike15’s picture

I would be very interested in seeing such feature developed as well which might help to further integrate the two sites

Thanks!

yngens’s picture

mike, for you to have this code until the module mainliners will do better way. this is very dirty solution, but still works:

<? 
mysql_connect("localhost", "db_user", "pass") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
mysql_query("SET NAMES UTF-8");

$result = mysql_query("SELECT * FROM `g2_Comment` ORDER BY `g2_Comment`.`g_id` DESC LIMIT 0,5") 
or die(mysql_error());  

echo "<table border='0'>";
while($row = mysql_fetch_array( $result )) {
	// Print out the contents of each row into a table
	echo "</td><td><a href=\"http://www.url.of.comment.page\"> - "; 
	echo $row['4'];
	echo "</a></td></tr>"; 
} 

echo "</table>";
?>
mike15’s picture

Snegny,

Thank you very much for providing a quick workaround. I was wondering where would I have to add this code to?

I would imagine it would be somewhere on the index page like a comment block

Regards,
Michael

yngens’s picture

create new block and add the code in php format. make sure to put correct username, database and password for the gallery DB.

mike15’s picture

Based on what you have recommended, I'm now able to pull Gallery comments into Drupal block. The problem now is that these comments I believe are in UTF-8 encoding (cyrillic) but when it is displayed in Drupal interface I see only question marks (????????) which means that context might not be presented correctly.

I was wondering if you had any recommendation on maybe inserting proper header information to block in order to display the data correctly.

Thanks,
Michael

kiz_0987’s picture

You can also add the Comments Block in G2 Site Admin->Themes Sidebar blocks. It's not perfect as it will only appear when a Gallery page is being viewed.

yngens’s picture

mike15, try to set Cyrillic encoding in line:

mysql_query("SET NAMES UTF-8");

alexandreracine’s picture

Component: Code » Code / API
Status: Active » Closed (duplicate)

Look at comment #6, or wait for the new module that will put image has node.

DEV version not supported anymore.

------------
Feel free to reopen but please look at the latest version first!

http://drupal.org/project/gallery

Closing (cleanup)