Forums / Developer / specific number of fields

specific number of fields

Author Message

Mazen Alsibai

Sunday 21 August 2005 12:49:29 am

Hi :
i want to show a few number of hte fields of an object when i want to edit it,how can i do that?
can anyone help me please?

Paul Borgermans

Sunday 21 August 2005 5:05:48 am

Hi

You need to create an override for the edit template. I suggest, you copy the default edit.tpl ans start from there:

Look for the loop which iterates over the attributes:

 {section name=ContentObjectAttribute loop=$content_attributes sequence=array(bglight,bgdark)}

Inside this loop, you can filter out one or more attributes like below

 {section show=array('attribute_identifier1','other_attribute_identifier')|contains($ContentObjectAttribute:item.contentclass_attribute_identifier) }
     
<label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label><div class="labelbreak"></div>
        <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
        {attribute_view_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
        </div>
    {section-else}
        <label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label><div class="labelbreak"></div>
        <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
        {attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
        </div>

    {/section}

In the example above, 2 attributes will be non-editable, just their value is shown. You may want to suppress the values output too visually, by eliminating <i>attribute_view_gui</i>, but it will be in the xhtml source code.

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Mazen Alsibai

Sunday 21 August 2005 10:30:43 am

Hi:
first thanks for care,
can i create 2 override for the template edit for one class, and how?