PEAK XOOPS - Re: Integrate non-D3 based module's comment with d3forum in englishin japanese

Re: Integrate non-D3 based module's comment with d3forum

List posts in the topic

none Re: Integrate non-D3 based module's comment with d3forum

msg# 1.1
depth:
1
Previous post - Next post | Parent - No child | Posted on 2008/7/2 13:01 | Last modified
GIJOE  ÀèǤ·³Áâ   Posts: 4110
hi kololok.

A good question!

Quote:

How to make non-D3 based module like myAlbum-P display the table of Target, Subject and Summary just like photos comment here?

This is an issue of "Comment Integration Class".

A sample class for myAlbum-P:

<?php

// a class for d3forum comment integration
class MyalbumD3commentPhotos extends D3commentAbstract {

function fetchSummary( $external_link_id )
{
	$db =& Database::getInstance() ;
	$myts =& MyTextsanitizer::getInstance() ;

	$module_handler =& xoops_gethandler( 'module' ) ;
	$module =& $module_handler->getByDirname( $this->mydirname ) ;

	$lid = intval( $external_link_id ) ;
	$mydirname = $this->mydirname ;
	if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;

	// query
	$myrow = $db->fetchArray( $db->query( "SELECT l.lid AS id,l.title AS subject,t.description AS body,l.ext FROM ".$db->prefix("myalbum_photos")." l LEFT JOIN ".$db->prefix("myalbum_text")." t ON l.lid=t.lid WHERE l.lid=$lid" ) ) ;

	$body = str_replace( '&nbsp;' , '' , $myts->displayTarea( $myrow['body'] ) ) ;
	$body = function_exists('easiestml') ? easiestml( $body ) : $body ;

	return array(
		'dirname' => $mydirname ,
		'module_name' => $module->getVar( 'name' ) ,
		'subject' => $myts->makeTboxData4Show( $myrow['subject'] ) ,
		'uri' => XOOPS_URL.'/modules/'.$mydirname.'/photo.php?lid='.intval($myrow['id']) ,
		'summary' => '<img src="'.XOOPS_UPLOAD_URL.'/photos/'.intval($myrow['id']).'.'.htmlspecialchars($myrow['ext']).'" width="120" />' ,
	) ;
}

}

?>

- Add the class file into the class folder module.
eg) modules/myalbum/class/MyalbumD3commentPhotos.class.php

- edit the forum "Format for comment-integration"
eg) myalbum::MyalbumD3commentPhotos::


There are many comment-integration-classes for many modules (of course, not D3 modules also)

for piCal
http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=5

for myAlbum-P
http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=1

for mydownloads
http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=8

for smartfaq
http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=7

for xoopspoll
http://www.photositelinks.com/modules/mydownloads/index.php?page=singlefile&cid=1&lid=9

Many thanks to photositelinks!
Votes:9 Average:7.78

Posts tree

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!