How to insert data into template blocks from action class?

Archived from the Xataface Users forum.

FractalizeR — Mon Oct 24, 2011 1:30 pm

I have a class

Code: Select all
class actions_my_action {}

in

Code: Select all
actions/my_action.php

file which renders templates via df_display(). How do I correctly insert data into template blocks? Is that possible? If not, what’s the workaround?


shannah — Mon Oct 24, 2011 1:44 pm

You do that via the template itself. Generally you extend from the Dataface_Main_Template.html template, and then fill one of the slots (usually main_section or main_column)

e.g.

Code: Select all
{use_macro file="Dataface_Main_Template.html"} {fill_slot name="main_section"} My content {/fill_slot} {/use_macro}

FractalizeR — Mon Oct 24, 2011 11:48 pm

I understand, but slots and blocks are different entities, right? When I override slot, I replace it’s contents. But when I use block, I add something into template, not replacing original contents. I’m using slots already. I’m just curious, can I use blocks too from action?