1
jmass
Calling block from within a custom block
  • 2004/7/28 16:00

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Helo!

I want to call a block (either headlines or news) from with in a custom block that I can really control the look and add a column to.

Any ideas or is there a better way to accomplish the same thing?

JMass

2
tjnemez
Re: Calling block from within a custom block
  • 2004/7/28 17:40

  • tjnemez

  • Home away from home

  • Posts: 1594

  • Since: 2003/9/21


why not just edit the existing blocks for news and headline module?

3
jmass
Re: Calling block from within a custom block
  • 2004/7/28 18:37

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


I have a custoom block that basically takes up the entire front page. It lays out just like I want it. I want to retrieve the 5 most recent news items in a certian area of the page that is not particularly congruant with anything else in the site.

I guess I could edit the template of the news block I would like and make that the "main page" block, but I usually like to leave things stock if possible and work from the outside in. That way updates to modules etc don't screw me up.

JMass

4
Herko
Re: Calling block from within a custom block
  • 2004/7/28 18:41

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


What about 'cloning' the news block (in templates/ blocks/ and xoops_version.php) and using the clone to make your customised version possible?

Herko

5
jmass
Re: Calling block from within a custom block
  • 2004/7/28 19:16

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Great Idea!

I did just that and am 90% done.

I need to know how to lengthen the lenght of the new title before it is truncated in the recent news block.

Any ideas?

JMass

6
jmass
Re: Calling block from within a custom block
  • 2004/7/28 19:32

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


Regarding extending the title text I find this in news_top.php:

function b_news_top_show($options) {

global $xoopsDB;

$myts =& MyTextSanitizer::getInstance();

$block = array();

$sql = "SELECT storyid, title, published, expired, counter FROM ".$xoopsDB->prefix("stories")." WHERE published < ".time()." AND published > 0 AND (expired = 0 OR expired > ".time().") ORDER BY ".$options[0]." DESC";

$result = $xoopsDB->query($sql,$options[1],0);

while ( $myrow = $xoopsDB->fetchArray($result) ) {

$news = array();

$title = $myts->makeTboxData4Show($myrow["title"]);

if ( !XOOPS_USE_MULTIBYTES ) {

if (strlen($myrow['title']) >= $options[2]) {

$title = $myts->makeTboxData4Show(substr($myrow['title'],0,($options[2] -1)))."...";

}

}

$news['title'] = $title;

$news['id'] = $myrow['storyid'];

if ( $options[0] == "published" ) {

$news['date'] = formatTimestamp($myrow['published'],"s");

} elseif ( $options[0] == "counter" ) {

$news['hits'] = $myrow['counter'];

}

$block['stories'][] = $news;

}

return $block;

}

Is this what I need to messing with? I can hard code a number into the:
"if (strlen($myrow['title']) >= $options[2]) {"
but is this the best thing to do?

JMAss

7
jmass
Re: Calling block from within a custom block
  • 2004/7/28 19:43

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


WOW AM I AN IDIOT!!!

It is in the block configuration.

WOW! Sorry for the wasted time.

On the plus side I did track it down and decipher the PHP code

JMass


Login

Who's Online

343 user(s) are online (73 user(s) are browsing Support Forums)


Members: 0


Guests: 343


more...

Donat-O-Meter

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

Latest GitHub Commits