1
hipoonios
Hack the "recent comment block"
  • 2008/1/18 12:38

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


I want to "hack" the recent comment block so it shows the content in the comment. Not just the the title.

I made up a screen to explain what i mean.

http://img255.imageshack.us/img255/5679/blockuf4.png

Anyone know how to do this?
I love Xoops!

2
wishcraft
Re: Hack the "recent comment block"

In /modules/system/templates/blocks you will find a smarty template called system_block_comments.html I think this is the one you need to alter, you will have to check the variable names in the PHP file that generates this, but this is the block i think that does 'recent comments' (don't quote me on this).

All you should have to do is make the block look and feel the way you want it and then refresh the module and clear your template_c path.

Thanks!
Resized Image
www.ohloh.net/accounts/226400

Follow, Like & Read:-

twitter.com/RegaltyFamily
github.com/Chronolabs-Cooperative
facebook.com/DrAntonyRoberts

3
hipoonios
Re: Hack the "recent comment block"
  • 2008/1/19 1:56

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Yes it is the /modules/system/templates/blocks/system_block_comments.html i have to edit. But dont really know what to do. I tried to add <{$comment.text}> to the block, but i didnt work. I guess its more complicated than that.
<table width="100%" cellspacing="1" class="outer">
  <{foreach 
item=comment from=$block.comments}>
  <
tr class="<{cycle values="even,odd"}>">
    <
td align="center"><img src="<{$xoops_url}>/images/<{$comment.icon}>" alt="" /></td>
    <
td><{$comment.title}></td>
    <
td align="center"><{$comment.module}></td>
    <
td align="center"><{$comment.poster}></td>
    <
td align="right"><{$comment.text}></td//My added line
<td align="right"><{$comment.time}></td>
  </
tr>
  <{/foreach}>
</
table>
I love Xoops!

4
trabis
Re: Hack the "recent comment block"
  • 2008/1/20 13:55

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Hi,
Yes that it!
Now one more step:

Go to system/blocks/system_blocks.php and

find this function:
function b_system_comments_show($options)

find this line:
$com['time'] = formatTimestamp($comments[$i]->getVar('com_created'),'m');

add just bellow:
$com['text']= $comments[$i]->getVar('com_text');

Ok, it should work now!

Oh, one thing, if you want to show smilies etc I think you must do it this way:

$myts =& MyTextSanitizer::getInstance();
$com['text'] = $myts->displayTarea($comments[$i]->getVar('com_text'),1,1,1);

5
hipoonios
Re: Hack the "recent comment block"
  • 2008/1/20 16:13

  • hipoonios

  • Friend of XOOPS

  • Posts: 298

  • Since: 2005/9/24


Thanks! It works!

Next step is to learn how to do a custom template for this block. For now both blocks using system_block_comments.html.

I guess I can't use template overriding as I'm using XOOPS 2.2?
I love Xoops!

6
trabis
Re: Hack the "recent comment block"
  • 2008/1/20 17:15

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


Maybe you can make an extra block:

Go to modules/system/xoops_version.php

add this:

$modversion['blocks'][13]['file'] = "system_blocks.php";
$modversion['blocks'][13]['name'] = _MI_SYSTEM_BNAME11;
$modversion['blocks'][13]['description'] = "Shows most recent comments";
$modversion['blocks'][13]['show_func'] = "b_system_comments_show_2";
$modversion['blocks'][13]['options'] = "10";
$modversion['blocks'][13]['edit_func'] = "b_system_comments_edit_2";
$modversion['blocks'][13]['template'] = 'system_block_comments_2.html';


Then make your 'system_block_comments_2.html'

And in system_blocks.php make a clone of the functions and name them:
b_system_comments_show_2
b_system_comments_edit_2

Update your system module and clean templates_c

Login

Who's Online

203 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 203


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits