Results 1 to 2 of 2

Thread: Catalog: Use fieldset legend in FE

  1. #1
    New user
    Join Date
    06-21-09.
    Location
    Germany
    Posts
    15

    Default Catalog: Use fieldset legend in FE

    Hi all,

    I'm trying to use the backend fieldset option for a better structured frontend layout. To accromplish this I thought it ought to work adding the legendTitle-field in a div if there's an insertBreak-vaule (this being 1 if BE fieldset grouping enabled). Thus I added this code (+) to catalog_full.tpl

    Code:
    <div class="field <?php echo $field; ?>">
    +  <?php if($entry['data']['insertBreak']['value']):?>
    +   <div class="groupTitle <?php echo $entry['data']['legendTitle']['value']; ?>"><?php echo $entry['data']['legendTitle']['value']; ?></div>
    +  <?php endif;?>
      <div class="label"><?php echo $data['label']; ?></div>
      <div class="value"><?php echo $data['value']; ?></div>
    </div>
    However this isn't working and neither insertBreak nor legendTitle are listed in the data entries array output so I guess the dca would have to be changed in order to display the legendTitle field in the FE. Is this correct? Would somebody help me with this? Because I only have a very basic php understanding and don't know what I would have to change there.

    Anke

  2. #2
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Catalog: Use fieldset legend in FE

    You're a bit off the mark here...

    The Legend group is ONLY a back-end function and the TL_DCA is not available in the front-end template level in any TL application. Legend groups in the FE is rather pointless, because the BE field-set might only be useful for data entry, but not useful for displaying the data in the FE. The FE can also have each LIST type and READER type modules have fields in a completely different order, so then a group where the order has been changed becomes meaningless and some legend groups may not even have fields being displayed (as they are for BE capture only, e.g. published, start, stop fields are not displayed but used for query instead).

    The easiest thing is to simply create your own manual groups in the template for the sections in code below:

    Code:
    <?php $groupnames = array ('field1'=>'My Group One', 'field5'=>'My Group Two'); ?>
    <div class="field <?php echo $field; ?>">
    <?php if (array_key_exists($field, $groupnames)): ?>
    <div class="group"><?php echo $groupnames[$field]; ?></div>
    <?php endif;?>
      <div class="label"><?php echo $data['label']; ?></div>
      <div class="value"><?php echo $data['value']; ?></div>
    </div>
    The field1 and field5 are the places where you would create your group breaks (before), You can just replace the titles with the correct ones, and then add more.

    Since you only ever have to do this once, when you've completed the database's field definitions, then you're set for that website. No need to go and write out complicated code to read it, assign it to a varible in the template and then go and read it out from the template.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •