How to do this with BLOCK VARS?

Discussion in 'CSS and HTML' started by SteveM, Aug 14, 2018.

  1. SteveM

    SteveM New Member

    Joined:
    Jul 31, 2018
    Messages:
    15
    Likes Received:
    1
    Ok, say I have a sql statement to get individual parties and all the guests invited. How do I assign the party information and each guest information with BLOCK VARIABLES and then get them to display in the template files?

    I have tried to assign all the party information to one block variable 'party' and all the guest information to another block variable 'guests' but in the template if I put in a
    PHP:
    <!-- BEGIN party --> display some of the party information
    <!-- BEGIN guests --> display all the guest information <!-- END guests -->
    display some more party information
    <!-- END party -->
    Well it doesn't work right. What am I doing wrong?
     
    Last edited by a moderator: Aug 15, 2018
  2. pani100

    pani100 Well-Known Member

    Joined:
    May 9, 2011
    Messages:
    2,327
    Likes Received:
    449
    How are you assigning these in the php?
    I take it you assign $template->assign_block_vars('party', array(
    'TITLE' => 'title',
    ....
    ));
    and then within a loop
    $template->assign_block_vars('party.guests', array(
    'TITLE' => 'title_inloop',
    ....
    ));

    PHP:
    <!-- BEGIN party --> display some of the party information using {party.TITLE}
    <!-- 
    BEGIN guests --> display all the guest information using  {party.guests.TITLE} <!-- END guests -->
    display some more party information using {party.TITLE}
    <!-- 
    END party -->
     

Share This Page