ok, I managed to get joomlacomment to work with Mamblog, but it was not easy and required hacking com_mamblog and com_content.
joomla 1.0.15
joomlacomment 3.26
The only way (I found) to show mamblogs with the comments+editor under it, is by displaying them in com_content. So when blogs are shown in full view thats in com_content.
So what I did was hack all links from mamblog to view items in full and make them go to com_content.
example-link:
index.php?option=com_content&task=view&id=181&Itemid=26
In category-blog-view (in com_mamblog) I inserted some code which produces a 'read more'-link, also linking to com_content. Underneath I inserted code which displays the comment-link. example:
'(3) comments
file:
components/com_mamblog/mamblog.html.php
line:
193
replace the entire function show() with:
function show( $blog, $mask=0, $gid, $option ) {
global $cfg_mamblog, $Itemid, $my, $mosConfig_live_site;
$create_date = null;
if (intval( $blog->created ) <> 0) {
$create_date = mosFormatDate($blog->created);
}
switch (intval($blog->state)) {
case 0: $state = _BLOG_UNPUBLISHED; break;
case 1: $state = _BLOG_PUBLISHED; break;
case -1: $state = _BLOG_ARCHIVED; break;
default: $state = _BLOG_UNKNOWNSTATE; break;
}
$attribs = mosParseParams( $blog->attribs );
$preset_attribs = mosParseParams( $cfg_mamblog['preset_values']['attribs'] );
?>
<?php if ( $cfg_mamblog['useattribs'] ) { ?>
<table cellpadding="<?php echo isset( $attribs->border ) ? $attribs->border : $preset_attribs->border; ?>" cellspacing="5" border="0" <?php echo isset( $attribs->width ) ? "width='$attribs->width'" : ""; ?> <?php echo isset( $attribs->height ) ? "height='$attribs->height'" : ""; ?> align="left">
<tr>
<td valign="top" bgcolor="<?php echo isset( $attribs->bordercolor ) ? $attribs->bordercolor : $preset_attribs->bordercolor; ?>">
<?php } ?>
<table cellpadding="0" cellspacing="5" border="0" width="100%" class="blogs"<?php if ( $cfg_mamblog['useattribs'] ) { ?> style="background-color: <?php echo isset( $attribs->bgcolor ) ? $attribs->bgcolor : $preset_attribs->bgcolor; ?>; color: <?php echo isset( $attribs->fgcolor ) ? $attribs->fgcolor : $preset_attribs->fgcolor; ?>; text-align: <?php echo isset( $attribs->textalign ) ? $attribs->textalign : $preset_attribs->textalign; ?>;" height="<?php echo isset( $attribs->height ) ? $attribs->height : $preset_attribs->height; ?>"<?php } ?>>
<tr>
<td width="100%">
<span class="blog_title">
<?php
global $my, $_MAMBOTS, $row, $params, $page, $database, $action;
if($blog->access <= $gid ) {
$blog->title = Badword::flush($blog->title, $my);
echo '<span class="contentheading" style="display: inline">';
//truncate string
$blog->title = strip_tags($blog->title);
if(strlen($blog->title)>60){
$blog->title = substr($blog->title, 0, 59).'...';
}
echo $blog->title;
echo '</span>';
} else {
$blog->title = Badword::flush($blog->title, $my);
$blog->title = strip_tags($blog->title);
if(strlen($blog->title)>60){
$blog->title = substr($blog->title, 0, 59).'...';
}
echo $blog->title;
}
if ( ( $my->id == $blog->created_by ) && !($mask&MASK_POPUP)) {?>
<a href="<?php echo sefRelToAbs( "index.php?option=$option&Itemid=$Itemid&task=edit&action=modify&id=$blog->id" ); ?>"><img src="images/M_images/edit.png" width="13" height="14" align="middle" border="0" alt="Edit" /></a>
<?php } ?>
</span>
<span class="blog_name">
<a href="<?php echo sefRelToAbs( "index.php?option=$option&Itemid=$Itemid&task=show&action=user&id=$blog->created_by" ); ?>"><?php echo $blog->author; ?></a> -
</span>
<span class="blog_date">
<?php echo $create_date; ?>
</span>
</td>
</tr>
<?php if ( ( $my->id == $blog->created_by ) ) { ?>
<tr>
<td class="createdate" colspan="4" align="left"><?php echo _BLOG_STATE . " " . $state; ?></td>
</tr>
<?php } ?>
<tr>
<td valign="top" colspan="4" class="blog_text"> <?php
//truncate string
if(strlen($blog->text)>600){
$blog->text = strip_tags($blog->text);
$blog->text = substr($blog->text, 0, 599).'...';
}
echo $blog->text;
//read more link
echo '<p style="margin-top: 5px;"><a href="';
$menuitem = '26';//menuitem id for general blog-page
echo sefRelToAbs( "index.php?option=com_content&task=view&id=$blog->id&Itemid=$menuitem" );
echo '">lees verder</a></p>';
//comment link
$blog_id = $blog->id;
$database->setQuery("SELECT id FROM jos_comment WHERE contentid='$blog_id'");
$comments = $database->loadResultArray();
$number_comments = count($comments);
echo '<p><a href="';
echo sefRelToAbs( "index.php?option=com_content&task=view&id=$blog->id&Itemid=$menuitem#JOSC_TOP" );
echo '">('.$number_comments.') reacties</a></p>';
?>
</td>
</tr>
<?php if ($mask&MASK_READON && trim( $blog->fulltext ) ) { ?>
<tr>
<td colspan="3" align="left">
<?php if($blog->access <= $gid ) { ?>
<a href="<?php echo sefRelToAbs( "index.php?option=$option&Itemid=$Itemid&task=show&action=view&id=$blog->id&Itemid=$Itemid" ); ?>" class="readon"><?php echo _BLOG_READ_ON;?></a>
<?php } else { ?>
<a href="<?php echo sefRelToAbs( "index.php?option=com_registration&task=register" ); ?>" class="readon"><?php echo _BLOG_READ_ON_REGISTER;?></a>
<?php } ?>
</td>
</tr>
<?php } ?>
<?php if ($mask&MASK_BACKTOLIST) { ?>
<tr>
<td colspan="3" align="center"><!--<a href="javascript:window.history.go(-1);"><?php echo _BACK; ?></a>--></td>
</tr>
<?php } ?>
</table>
<?php if ( $cfg_mamblog['useattribs'] ) { ?>
</td></tr>
</table>
<?php } ?>
<?php
}
and file:
components/com_mamblog/showblogs.php
line:
294
if ( $cfg_mamblog['showarchivelink'] && $type == "user" && intval( $id ) ) {
echo "<br clear='all' /><a href='" . sefRelToAbs( "index.php?option=$option&Itemid=$Itemid&task=show&action=userarchive&id=$id" ) . "'><strong>" . _BLOG_USERARCHIVE . "</strong></a><br />";
}
replace with:
if ( $cfg_mamblog['showarchivelink'] && $type == "user" && intval( $id ) ) {
$user_id = mosGetParam( $_REQUEST, 'id', '' );
if($action=='user' && $my->id!=$user_id){
$menuitem = '26';//menu-id of genaral blogs-page
}else{
$menuitem = '36';//menu-id of users archived blogs
}
echo "<br clear='all' /><a href='" . sefRelToAbs( "index.php?option=$option&Itemid=$menuitem&task=show&action=userarchive&id=$id" ) . "'><strong>" . _BLOG_USERARCHIVE . "</strong></a><br />";
}
I hacked com_content to show the edit-button for users to edit their blog (linking to com_mamblog).
file:
components/com_content/content.html.php
line:
442
replace the entire function show() with:
function show( &$row, &$params, &$access, $page=0 ) {
global $mainframe, $hide_js;
global $mosConfig_live_site;
global $_MAMBOTS, $task, $database, $my;
$mainframe->appendMetaTag( 'description', $row->metadesc );
$mainframe->appendMetaTag( 'keywords', $row->metakey );
// adds mospagebreak heading or title to <site> Title
if ( isset($row->page_title) && $row->page_title ) {
$mainframe->setPageTitle( $row->title .' '. $row->page_title );
}
// calculate Itemid
HTML_content::_Itemid( $row );
// determines the link and `link text` of the readmore button & linked title
HTML_content::_linkInfo( $row, $params );
// link used by print button
$print_link = $mosConfig_live_site. '/index2.php?option=com_content&task=view&id=' . $row->id .'&pop=1&page='. $page . $row->Itemid_link;
// process the new bots
$_MAMBOTS->loadBotGroup( 'content' );
$results = $_MAMBOTS->trigger( 'onPrepareContent', array( &$row, &$params, $page ), true );
if ( $access->canEdit ) {
// edit icon
HTML_content::EditIcon( $row, $params, $access );
}
$title = $row->title;
if($title!=''){
if ( $params->get( 'item_title' ) || $params->get( 'pdf' ) || $params->get( 'print' ) || $params->get( 'email' ) ) {
?>
<table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
<tr>
<?php
// displays Item Title
HTML_content::Title( $row, $params, $access );
// displays Created Date
//HTML_content::CreateDate( $row, $params );
// displays PDF Icon
HTML_content::PdfIcon( $row, $params, $hide_js );
// displays Print Icon
mosHTML::PrintIcon( $row, $params, $hide_js, $print_link );
// displays Email Icon
HTML_content::EmailIcon( $row, $params, $hide_js );
?>
</tr>
</table>
<?php
}
}//end if when title is shown
if ( !$params->get( 'intro_only' ) ) {
$results = $_MAMBOTS->trigger( 'onAfterDisplayTitle', array( &$row, &$params, $page ) );
echo trim( implode( "\n", $results ) );
}
$results = $_MAMBOTS->trigger( 'onBeforeDisplayContent', array( &$row, &$params, $page ) );
echo trim( implode( "\n", $results ) );
?>
<table class="contentpaneopen<?php echo $params->get( 'pageclass_sfx' ); ?>" width="100%">
<?php
// displays Section & Category
HTML_content::Section_Category( $row, $params );
// displays Author Name
HTML_content::Author( $row, $params );
// displays Created Date
//HTML_content::CreateDate( $row, $params );
// displays Urls
HTML_content::URL( $row, $params );
?>
<tr>
<td valign="top" colspan="2">
<?php
// displays Table of Contents
HTML_content::TOC( $row );
// displays Item Text
echo ampReplace( $row->text );
?>
</td>
</tr>
<?php
// displays Modified Date
HTML_content::ModifiedDate( $row, $params );
// displays Readmore button
HTML_content::ReadMore( $row, $params );
?>
</table>
<?php
//trigger bots for event IJoomlaComments
//$results = $_MAMBOTS->trigger( 'IJoomlaComments', array( &$row, &$params, $page ), true );
//echo trim( implode( "\n", $results ) );
?>
<span class="article_seperator"> </span>
<?php
$results = $_MAMBOTS->trigger( 'onAfterDisplayContent', array( &$row, &$params, $page ) );
echo trim( implode( "\n", $results ) );
// displays the next & previous buttons
HTML_content::Navigation ( $row, $params );
// displays close button in pop-up window
mosHTML::CloseButton ( $params, $hide_js );
// displays back button in pop-up window
mosHTML::BackButton ( $params, $hide_js );
}
and in the same file replace the function title() with
function Title( &$row, &$params, &$access ) {
global $my;
if ( $params->get( 'item_title' ) ) {
if ( $params->get( 'link_titles' ) && $row->link_on != '' ) {
?>
<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" >
<a href="<?php echo $row->link_on;?>" class="contentpagetitle<?php echo $params->get( 'pageclass_sfx' ); ?>">
<?php echo $row->title;?></a>
<?php HTML_content::EditIcon( $row, $params, $access ); ?>
</td>
<?php
} else {
?>
<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" >
<?php
echo $row->title;
if($row->sectionid==4){
//display edit icon
if ($my->id==$row->created_by){
echo '<a href="index.php?option=com_mamblog&Itemid=28&task=edit&action=modify&id='.$row->id.'"><img src="images/M_images/edit.png" width="13" height="14" align="middle" border="0" alt="Edit" /></a>';
}
//display bloggers name
echo '<span class="blog_name_content">';
echo '<a href="';
//$url = sefRelToAbs( "index.php?option=com_comprofiler&task=userProfile&user=$row->created_by&Itemid=31" );links to proflie
$url = sefRelToAbs( "index.php?option=com_mamblog&Itemid=26&task=show&action=user&id=$row->created_by" );
echo $url;
echo '">';
$author_id = $row->created_by;
//get username
global $database;
$database->setQuery("SELECT username FROM jos_users WHERE id=$author_id LIMIT 1");
$author_rows = $database-> loadObjectList();
$author = $author_rows[0];
$username = $author->username;
echo $username;
echo '</a> -</span>';
}else{
echo ' ';
}
echo '<span class="creation_date">';
//HTML_content::CreateDate( $row, $params );
echo mosFormatDate( $row->created );
echo '</span>';
?>
<?php //HTML_content::EditIcon( $row, $params, $access ); ?>
</td>
<?php
}
} else {
?>
<td class="contentheading<?php echo $params->get( 'pageclass_sfx' ); ?>" >
<?php //HTML_content::EditIcon( $row, $params, $access ); ?>
</td>
<?php
}
}
note that in this code the date is display right next to the items' title. You might want to rip that out.
Then I switched the 'read more' and comment-link around using this hack
compojoom.com/index.php/forum.html?func=...&id=611&start=10#611