1
sunsnapper
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?

2
sunsnapper
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?

3
Mithrandir
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.

4
pod
Re: Copy content from a Block to a Template
  • 2005/4/26 11:48

  • pod

  • Quite a regular

  • Posts: 301

  • Since: 2003/4/19


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 ;)]

5
sunsnapper
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

6
sunsnapper
Re: Copy content from a Block to a Template

Am I using the correct terminology?

7
sunsnapper
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).


Login

Who's Online

192 user(s) are online (101 user(s) are browsing Support Forums)


Members: 0


Guests: 192


more...

Donat-O-Meter

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

Latest GitHub Commits