xoops forums

sunsnapper

Friend of XOOPS
Posted on: 2005/4/24 22:47
sunsnapper
sunsnapper (Show more)
Friend of XOOPS
Posts: 403
Since: 2002/4/10
#1

Copy content from a Block to a Template

How can I add content from a block into a template?

I am trying to add the Recent Comments Block (newbb_block_new)
to the index template for newbb (newbb_index)

Going in, I thought it would be fairly straightforward to copy and paste the block into the template. I removed the <if> and <else> clauses, since I always want it to appear, regardless of whether a block is set to visible.

However, it does not generate the content. I thought perhaps it was due to the variables still being $block. variables, so I removed the "block." prefix, with no success.

I am sure it comes down to some difference between blocks and templates that I do not yet know... but, I suspect this should be fairly easy to pull off.

(Before anyone suggests simply turning on the block to make it visible, this causes the block to appear on every post of the discussion. I only want it to appear on the discussion index page.)

Any thoughts?

sunsnapper

Friend of XOOPS
Posted on: 2005/4/26 11:09
sunsnapper
sunsnapper (Show more)
Friend of XOOPS
Posts: 403
Since: 2002/4/10
#2

Re: Copy content from a Block to a Template

I've searched the FAQ and the forum, but, I don't see any related posts... anyone?

Mithrandir

XOOPS is my life!
Posted on: 2005/4/26 11:47
Mithrandir
Mithrandir (Show more)
XOOPS is my life!
Posts: 6320
Since: 2003/6/21
#3

Re: Copy content from a Block to a Template

Perhaps look at the block function, since that is what generates the content. The template just positions it.

pod

Quite a regular
Posted on: 2005/4/26 11:48
pod
pod (Show more)
Quite a regular
Posts: 301
Since: 2003/4/19
#4

Re: Copy content from a Block to a Template

I've tried... its really not that easy. I think ur first step would be to isolate the php file that generates the block & edit the output string - instead of it generating block.variables have it output the data you want directly & save it with a different name, dont overwrite the original. Then... I dunno... I dont think we can have php includes in our theme.html so besides importing the data to flash & displaying it that way, I can't help ya from there.

Bet someone here could shed some light...

[Edit: yeah, what Mithrandir said ;)]

sunsnapper

Friend of XOOPS
Posted on: 2005/4/27 2:16
sunsnapper
sunsnapper (Show more)
Friend of XOOPS
Posts: 403
Since: 2002/4/10
#5

Re: Copy content from a Block to a Template

I may be using the wrong terms... I thought the Theme controls positioning, but, the templates (included with each module) control the module output.

I am trying to add the Recent Comments Block (newbb_block_new)
to the index template for newbb (newbb_index)

(Both are found in the Admin area for newbb templates).

So, I'm not trying to put this in theme.html

sunsnapper

Friend of XOOPS
Posted on: 2005/4/28 20:36
sunsnapper
sunsnapper (Show more)
Friend of XOOPS
Posts: 403
Since: 2002/4/10
#6

Re: Copy content from a Block to a Template

Am I using the correct terminology?

sunsnapper

Friend of XOOPS
Posted on: 2005/5/1 1:53
sunsnapper
sunsnapper (Show more)
Friend of XOOPS
Posts: 403
Since: 2002/4/10
#7

Re: Copy content from a Block to a Template

Has anyone done something like this? If I'm reading the suggestions correctly, I believe that's what I already tried (see first post).